Yandex Search Scraping

node v8.17.0
version: 1.0.0
endpointsharetweet
const cheerio = require('cheerio') const sf = require('snekfetch') const query = 'wallpaper' const locale = 'en' let html = (await sf.get(`https://www.yandex.com/search/?text=${query}&lang=${locale}`)).text const $ = cheerio.load(html) Array.from($('*:not(.composite) > .organic')).map(r => ({ title: $('.organic__url-text', r).text(), url: $('.organic__url', r).attr('href'), description: $('.organic__text', r).text(), rawDescription: $('.organic__text', r).html().replace(/&#x(\d+);/g, (_, cp) => String.fromCodePoint(parseInt(cp, 16))), icon: `https://favicon.yandex.net/favicon/${$('.organic__url', r).attr('href').split('/')[2]}` }))
Loading…

no comments

    sign in to comment