lundi 7 août 2017

Cheerio -Web Scraping - Not able to scrape innertext of a div

I am using Cheerio and request for web scraping. Below is my code on running which it doesn't give any error but also it doesn't gives me the innerText of div with that class name.

I am a beginner in this technology. So not able to figure out where i am missing something.

request(baseurl,function(err,resp,body){
        if(!err && resp.statusCode==200){

        var $=cheerio.load(body);
        $('div.class','#EIGTDNC-d-W EIGTDNC-d-Lb EIGTDNC-d-S EIGTDNC-d-mb EIGTDNC-d-bc').each(function(){
        temp=this.attr('innerText');
        console.log(temp);
        });
        //console.log('body',body);*/
        //send the message back to user

        }
        else{
        console.log('error:', err); 
        console.log('statusCode:', resp && resp.statusCode); 
        }




    });
    //dom closed




Aucun commentaire:

Enregistrer un commentaire