Skip to content

Instantly share code, notes, and snippets.

@gourneau
Created June 7, 2012 21:32
Show Gist options
  • Select an option

  • Save gourneau/2891664 to your computer and use it in GitHub Desktop.

Select an option

Save gourneau/2891664 to your computer and use it in GitHub Desktop.
hos domrip
var request = require('request')
var jsdom = require('jsdom')
var _ = require('underscore.string')
request({ uri:'http://www.hos.com/php/printProgram2.php?program=0927' }, function (error, response, body) {
if (error) {
console.log('Error downloading page')
process.exit(1)
}
jsdom.env({
html: body,
scripts: ['http://code.jquery.com/jquery-1.6.min.js']
}, function (err, window) {
var $ = window.jQuery;
$("p.archiveTextBlk i").each(function(i){
var artist
//artist
if (i === 0){
artist = _.unescapeHTML(_.clean( $(this).parent().text().split("\r\n")[3]) ).toLowerCase()
}else{
artist = _.unescapeHTML($(this).parent().html().split("<br>")[0]).toLowerCase()
}
//track
var track
track = _.clean($(this).text())
console.log(artist + " - " + track)
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment