two module of Node will help you to parse any website .
cheerio
request
try to install cheerio and request module at node JS
npm install request
npm install cheerio
Initialize request and cheerio at node script
const request = require('request');
const cheerio = require('cheerio');
try to get request
request('http://www.example.com', function (error, response, html) {
if (!error && response.statusCode == 200) {
var $ = cheerio.load(html);
$('script').each(function (i, element) {
a = $(this);
alert(a.text());
});
}
});
request function will give you response and cheerio help you to read it as per need
var $ = cheerio.load(html);
cheerio.load will load html
and you can use cheerio other accessor function which help you to get html as we do in jQuery.
some example of usage of cheerio
$('#data').children().first().text()
it will give you text of first children of element which have data element id
use find to find elements in given html
$('#data').find('li').length
it will find li element in element which have data element id , and give the length of li elements