Skip to content

Instantly share code, notes, and snippets.

@xaqrox
Created June 1, 2016 15:50
Show Gist options
  • Save xaqrox/e69b385921c3561c028f44a7b0d01a99 to your computer and use it in GitHub Desktop.
Save xaqrox/e69b385921c3561c028f44a7b0d01a99 to your computer and use it in GitHub Desktop.
var http = require('http'),
env = require('jsdom').env,
_ = require('underscore');
http.get(
{
host: 'pitchfork.com',
port: '80',
path: 'reviews/albums/20189-the-moon-rang-like-a-bell-remixed',
},
function (res) {
res.setEncoding('utf8');
res.on('data', function (data) {
env(data, function (errors, window) {
console.log(data);
var $ = require('jquery')(window)
, $meta = $('.review-meta .info')
, artist = $meta.find('h1 a').html()
, album = $meta.find('h2').html()
, $byline = $meta.find('h4')
, reviewer = $byline.find('address').html()
, date = $byline.find('.pub-date').html()
, score = $meta.find('.score').html()
, bnm = $meta.find('.bnm-label').html() == 'Best New Music' ? true : false;
console.log(artist);
console.log(album);
console.log(reviewer);
console.log(date);
console.log(score);
console.log(bnm);
});
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment