Skip to content

Instantly share code, notes, and snippets.

@jherskowitz
Created April 23, 2011 01:12
Show Gist options
  • Save jherskowitz/938086 to your computer and use it in GitHub Desktop.
Save jherskowitz/938086 to your computer and use it in GitHub Desktop.
if (window.url.indexOf("pitchfork.com/forkcast") != -1)
{
Playgrub.source.url = 'http://pitchfork\.com.*/forkcast.*';
Playgrub.source.error = 'Tomahawk currently supports the Track Reviews & Forkcast pages only. Please check your url.';
Playgrub.source.scrape = function() {
$("h1.title").each(function () {
var song_result = $($(this).children('a')[1]).text();
song_result = song_result.replace('"', '');
var artist = $($(this).children('a')[0]).text();
Playgrub.playlist.add_track(artist, song_result);
});
}
Playgrub.source.start();
} else if
Playgrub.source.url = 'http://pitchfork\.com/reviews/tracks';
Playgrub.source.error = 'Tomahawk currently supports the Track Reviews and Best New Tracks page only. Please check your url.';
Playgrub.source.scrape = function() {
$("h2.tombstone").each(function () {
var song_result = $($(this).children('a')[1]).text();
song_result = song_result.substring(1, song_result.length-1);
var artist = $($(this).children('a')[0]).text();
Playgrub.playlist.add_track(artist, song_result);
});
}
Playgrub.source.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment