Skip to content

Instantly share code, notes, and snippets.

Last active Apr 30, 2019
What would you like to do?
Cheerio.js Setup
require('events').EventEmitter.defaultMaxListeners = 100;
const cheerio = require('cheerio');
const request = require('request');
method: 'GET',
url: ''
}, (err, res, body) => {
if (err) return console.error(err);
let $ = cheerio.load(body);
let title = $('title').text();
console.log(title); // Log the page title to the terminal
// Iterate over each of the posts on the page and log the url to the terminal
$('div.imagewrap > a').each(function(index, elem) {
let link = $(elem).attr('href');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment