Created
January 21, 2016 12:54
-
-
Save andrewjmead/8e7ad2908342b87e83b4 to your computer and use it in GitHub Desktop.
Request & Cheerio Scraping Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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