javascript - Scrape all list <li> items in an <ul> using node js -


i trying contents in lists have similar class attribute. want use cheerio, requests , jquery so.

the list elements of form:

<a href="/anime/12-oz-mouse" class="ui-btn ui-btn-icon-right ui-icon-carat-r">12 oz. mouse</a> 

so i'm trying use a.ui-btn ui-btn-icon-right ui-icon-carat-r select elements , print them. i'm not seeing results when run below, thoughts how can display of list elements; want names of cartoons here.

var request = require('request'); var cheerio = require('cheerio');  request('http://m.watchcartoononline.com/cartoon-list', function (error, response, html) {   if (!error && response.statuscode == 200) {     var $ = cheerio.load(html);     $('a.ui-btn.ui-btn-icon-right.ui-icon-carat-r').each(function(i,e){         console.log("cartoon " + $(this).text());     });   } }); 

the problem is, classes added using script after page loaded, page source don't have classes.

what can try

request('http://m.watchcartoononline.com/cartoon-list', function (error, response, html) {   if (!error && response.statuscode == 200) {     var $ = cheerio.load(html);     $('ul[data-role="listview"] > li > a[href]').each(function(i,e){         console.log("cartoon " + $(this).text());     });   } }); 

Comments