Created
December 26, 2009 00:10
-
-
Save jphastings/263791 to your computer and use it in GitHub Desktop.
Some Playgrub scrapers I've hacked together
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Absolute Radio Playlist Scraper | |
| * Created by: JP Hastings-Spital & Lucas Gonze | |
| * Version: 0.1 | |
| * | |
| * Notes: | |
| * | |
| * Absolute Radio playlist - this one is a bit naughty (removing <strong> | |
| * elements from the playlist, cos I cba to work around their irritating | |
| * code) but it looks like playgrub and this website don't play nice. See | |
| * the absoluteradio_firebug_error.txt file. | |
| * | |
| * To test, go to http://www.absoluteradio.co.uk/music/we_play/playlist/ | |
| */ | |
| Playgrub.source.url = 'http://www.absoluteradio.co.uk/music/we_play/playlist/'; | |
| Playgrub.source.error = 'Sorry, no suitable songs could be found'; | |
| Playgrub.source.scrape = function() { | |
| $('#playlist strong').remove(); | |
| $("#playlist a").each(function () { | |
| try { | |
| var artist = $(this).text(); | |
| var title = $(this).next('br')[0].nextSibling.nodeValue; | |
| if( artist && title && artist != "" && title != "") | |
| Playgrub.playlist.add_track(artist,title); | |
| } catch (err) { | |
| } | |
| }); | |
| } | |
| Playgrub.source.start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $("#onair_playing_now").getElementsByTagName is not a function | |
| [Break on this error] var aSpans = $('#onair_playing_now').getElementsByTagName('span');\ncore.js?...=1.0.0.15 (line 283) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Kerrang Radio Playlist Scraper | |
| * Created by: JP Hastings-Spital & Lucas Gonze | |
| * Version: 0.1 | |
| * | |
| * Notes: | |
| * | |
| * The Kerrang Radio playlist | |
| * | |
| * To test, go to http://www.kerrangradio.co.uk/playlist.asp | |
| */ | |
| Playgrub.source.url = 'http://www.kerrangradio.co.uk/playlist.asp'; | |
| Playgrub.source.error = 'Sorry, no suitable songs could be found'; | |
| Playgrub.source.scrape = function() { | |
| $("form table tr td font.Text").each(function () { | |
| var artist = $(this).find('b').text(); | |
| var title = $(this).find('br')[0].nextSibling.nodeValue; | |
| console.log(title); | |
| if( artist && title && artist != "" && title != "") | |
| Playgrub.playlist.add_track(artist,title); | |
| }); | |
| } | |
| Playgrub.source.start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * NME Radio Playlist Scraper | |
| * Created by: JP Hastings-Spital & Lucas Gonze | |
| * Version: 0.1 | |
| * | |
| * Notes: | |
| * | |
| * The NME Radio playlist | |
| * | |
| * To test, go to http://www.nme.com/radio/playlist | |
| */ | |
| Playgrub.source.url = 'http://www.nme.com/radio/playlist'; | |
| Playgrub.source.error = 'Sorry, no suitable songs could be found'; | |
| Playgrub.source.scrape = function() { | |
| $("div.main_block table.track_list tr").each(function () { | |
| var artist = $(this).find('td a').text(); | |
| var title = $(this).find('td.title').text() | |
| if( artist && title && artist != "" && title != "") | |
| Playgrub.playlist.add_track(artist,title); | |
| }); | |
| } | |
| Playgrub.source.start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * BBC Radio 1 Charts Scraper | |
| * Created by: JP Hastings-Spital & Lucas Gonze | |
| * Version: 0.1 | |
| * | |
| * Notes: | |
| * | |
| * To test, go to http://www.bbc.co.uk/radio1/chart/singles | |
| */ | |
| Playgrub.source.url = 'http://www.bbc.co.uk/radio1/chart/*'; | |
| Playgrub.source.error = 'Oops, make sure its a singles chart!'; | |
| Playgrub.source.scrape = function() { | |
| if (/singles\/$/.test(location.href)) { | |
| $("div.chart li").each(function () { | |
| var artist = $(this).find("span.artist").text(); | |
| var title = $(this).find("span.track").text(); | |
| if( artist && title && artist != "" && title != "") | |
| Playgrub.playlist.add_track(artist,title); | |
| }); | |
| } | |
| } | |
| Playgrub.source.start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * BBC Radio 1 Playlist Scraper | |
| * Created by: JP Hastings-Spital & Lucas Gonze | |
| * Version: 0.1 | |
| * | |
| * Notes: | |
| * | |
| * Lets you be a Radio 1 DJ! | |
| * | |
| * Need to think about amalgamating these BBC scrapers. They can't all | |
| * have the correct filename. Any ideas Lucas? This one's quite different. | |
| * | |
| * To test, go to http://www.bbc.co.uk/radio1/playlist/ | |
| */ | |
| Playgrub.source.url = 'http://www.bbc.co.uk/radio1/playlist/'; | |
| Playgrub.source.error = 'Sorry, no suitable songs could be found'; | |
| Playgrub.source.scrape = function() { | |
| $("div.artists_and_songs ul.clearme").each(function () { | |
| var artist = $(this).find("li.artist").text(); | |
| console.log(artist); | |
| var title = $(this).find("li.song").text(); | |
| if( artist && title && artist != "" && title != "") | |
| Playgrub.playlist.add_track(artist,title); | |
| }); | |
| } | |
| Playgrub.source.start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * BBC Radio 2 Playlist Scraper | |
| * Created by: JP Hastings-Spital & Lucas Gonze | |
| * Version: 0.1 | |
| * | |
| * Notes: | |
| * | |
| * The Radio 2 playlist appears to be maintained by hand, so this | |
| * probably won't be very useful. But its here anyway. I'm still | |
| * too full on Christmas turkey to sleep! | |
| * | |
| * To test, go to http://www.bbc.co.uk/radio2/music/playlist/ | |
| */ | |
| Playgrub.source.url = 'http://www.bbc.co.uk/radio2/music/playlist/'; | |
| Playgrub.source.error = 'Sorry, no suitable songs could be found'; | |
| Playgrub.source.scrape = function() { | |
| $("div.box ol li div.record").each(function () { | |
| var artist = $(this).text().split("- ")[0]; | |
| var title = $(this).text().split("- ")[1]; | |
| if( artist && title && artist != "" && title != "") | |
| Playgrub.playlist.add_track(artist,title); | |
| }); | |
| } | |
| Playgrub.source.start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * World Music Charts Europe Scraper | |
| * Created by: JP Hastings-Spital & Lucas Gonze | |
| * Version: 0.1 | |
| * | |
| * Notes: | |
| * | |
| * This one is a little obscure - just to give playgrub some wider | |
| * music tastes! Its certainly a little hacky… | |
| * | |
| * To test, go to http://www.wmce.de/ | |
| */ | |
| Playgrub.source.url = 'http://www.wmce.de/'; | |
| Playgrub.source.error = 'Sorry, no suitable songs could be found.'; | |
| Playgrub.source.scrape = function() { | |
| $("#top20 tr").each(function () { | |
| try { | |
| var artist = $(this).find("td.song").text().match(/\n\W+(.+),\ .+$/)[1]; | |
| } catch(err) { | |
| var artist = ""; | |
| } | |
| var title = $(this).find("td.song a").text(); | |
| if( artist && title && artist != "" && title != "") | |
| Playgrub.playlist.add_track(artist,title); | |
| }); | |
| } | |
| Playgrub.source.start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * XFM Playlist Scraper | |
| * Created by: JP Hastings-Spital & Lucas Gonze | |
| * Version: 0.1 | |
| * | |
| * Notes: | |
| * | |
| * Be an XFM DJ! | |
| * | |
| * To test, go to http://www.xfm.co.uk/onair/playlist | |
| */ | |
| Playgrub.source.url = 'http://www.xfm.co.uk/onair/playlist'; | |
| Playgrub.source.error = 'Sorry, no suitable songs could be found'; | |
| Playgrub.source.scrape = function() { | |
| $("table.playlist tr").each(function () { | |
| var artist = $(this).find('td').eq(0).text(); | |
| var title = $(this).find('td.track_title').text(); | |
| if( artist && title && artist != "" && title != "") | |
| Playgrub.playlist.add_track(artist,title); | |
| }); | |
| } | |
| Playgrub.source.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment