Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Worten
- var smartphone = [];
- $('#products-list-block .w-product').each(function(k,v){
- smartphone.push({
- "name" : $(this).find(".w-product__title").text().replace(/ *\([^)]*\) */g, ""),
- "brand" : $(this).data('brand');
- "pageUrl": $(this).find(".w-product__url").attr("href"),
- "price": $(this).find(".w-currentPrice.iss-current-price .w-product-price__main").text() + "." + $(this).find(".w-currentPrice.iss-current-price .w-product-price__dec").text(),
- "details" : $(this).find(".w-product__title").text().match(/\(([^)]+)\)/)[1],
- "imgUrl" : "http://www.worten.pt" + $(this).find("img").attr("data-src"),
- "dateTime" : new Date().getTime(),
- "store" : "worten",
- });
- });
- #Fnac
- var $ = cheerio.load(responseBody);
- var smartphone = [];
- $(".Article-item").each(function(){
- let title = $(this).find(".Article-title").text().replace('Smartphone', '').trim();
- smartphone.push({
- "name" : title.substring(0, title.indexOf('-')).trim(),
- "pageUrl" : $(this).find(".Article-title").attr('href'),
- "price": $(this).find(".floatl .userPrice").text().replace(/\,/g, '.').replace(/[^0-9/.]/gi, ''),
- "details" : title.split(/-(.+)/)[1].trim(),
- "imgUrl" : $(this).find("img").attr("src"),
- "dateTime" : new Date().getTime(),
- "store" : "fnac",
- });
- });
- pm.environment.set("fnac", JSON.stringify(smartphone));
- console.log(smartphone);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement