Answers for "cheerio"

0

cheerio example

const cheerio = require('cheerio');

let $ = cheerio.load(<body>);
let title = $('title');
console.log(title.text());
Posted by: Guest on January-11-2021
0

cheerio

var request = require('request'), cheerio = require('cheerio');

//Загружаем страницу
request({uri:'http://www.amazon.com/', method:'GET', encoding:'binary'},
function (err, res, page) {
//Передаём страницу в cheerio
var $=cheerio.load(page);
//Идём по DOM-дереву обычными CSS-селекторами
img_src=$('div.s9a3 > div > div > a > div > div > img').attr("src");
console.log(img_src);
});
Posted by: Guest on August-23-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language