Skip to content

Instantly share code, notes, and snippets.

@squidge
Last active August 29, 2015 13:57
Show Gist options
  • Save squidge/9557423 to your computer and use it in GitHub Desktop.
Save squidge/9557423 to your computer and use it in GitHub Desktop.
node-request-cheerio
request('https://news.ycombinator.com', function (error, response, html) {
console.log(response);
if (!error && response.statusCode == 200) {
var $ = cheerio.load(html);
$('span.comhead').each(function(i, element){
var a = $(this).prev();
console.log(a.text());
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment