1
I’m studying Web Scrapping with Cheerio and Request. I’m having a hard time trying to capture the class attribute on the Amazon site that contains a div list and is not returning anything.
var Crawler = {
request : null,
cheerio : null,
init : function(){
Crawler.request = require('request');
Crawler.cheerio = require('cheerio');
Crawler.getProducts();
},
getProducts: function(){
Crawler.request('https://www.amazon.com.br/s?k=notebook&__mk_pt_BR=%C3%85M%C3%85%C5%BD%C3%95%C3%91&crid=13P0U6JH9AMHS&sprefix=%2Caps%2C416&ref=nb_sb_ss_i_1_1', function(err, res, body){
if(err) console.log('Error: ' + err);
var $ = Crawler.cheerio.load(body);
$('div.s-result-list.s-search-results.sg-row div').each(function(){
console.log("capturou");
});
});
}
};
Crawler.init();
What am I doing wrong ?