Skip to content

Instantly share code, notes, and snippets.

@whichlight
Created June 17, 2012 02:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save whichlight/2943170 to your computer and use it in GitHub Desktop.
Save whichlight/2943170 to your computer and use it in GitHub Desktop.
example code for a blog post on scraping with ndoe
//see whichlight.com/blog/writing-a-web-scraper-over-http-with-nodejs for details
app.get('/pullstagram/:link?', function(req,res){
url = req.params.link;
console.log(url);
request(url,function(err,response,body){
if (!err && response.statusCode == 200) {
var window = jsdom(body).createWindow(),
$ = require('jquery').create(window);
var val = $('.photo').attr('src');
console.log(val);
res.send(val);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment