Skip to content

Instantly share code, notes, and snippets.

@andrewjmead
Created January 21, 2016 12:54
Show Gist options
  • Save andrewjmead/8e7ad2908342b87e83b4 to your computer and use it in GitHub Desktop.
Save andrewjmead/8e7ad2908342b87e83b4 to your computer and use it in GitHub Desktop.
Request & Cheerio Scraping Example
var request = require('request');
var cheerio = require('cheerio');
request('https://www.reddit.com/', function (error, response, body) {
$ = cheerio.load(body);
$('a.title').each(function (i, elem) {
console.log('');
console.log('** Link ** ')
console.log($(this).text());
console.log($(this).attr('href'));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment