Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions scrapers/mog.com.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* MOG.com Playgrub Scraper
* Created by: Niall Smart <niall AT pobox DOT com>
* Version: 0.1
*
* Notes:
*
* This scraper will work on MOG.com playlist pages.
*/
Playgrub.source.url = 'http://.*\.mog.com.*';
Playgrub.source.error = 'Check your MOG page - only playlist pages are supported.'
Playgrub.source.scrape = function() {

$(".song-title").each(function() {
var artist = $(this).find('a:last-child').text();
var song = $(this).find('a:first-child').text();

artist = $.trim(artist);
song = $.trim(song);

if (artist && song) {
Playgrub.playlist.add_track(artist, song);
}
});
}

Playgrub.source.start();
38 changes: 38 additions & 0 deletions scrapers/rdio.com.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Rdio.com Playgrub Scraper
* Created by: Niall Smart <niall AT pobox DOT com>
* Version: 0.1
*
* Notes:
*
* This scraper will work on Rdio.com artist/album/playlist pages.
*/
Playgrub.source.url = 'http://.*\.rdio.com.*';
Playgrub.source.error = 'Check your Rdio page - only artist, album and playlist pages are supported.'
Playgrub.source.scrape = function() {

var albumArtist;
var ah = $("div.album_header");

if (ah.size() > 0) {
albumArtist = ah.find("a.mini_header").text();
}

$("div.track").each(function() {
var artist = $(this).find('div.album_info > a:first-child').text();
var song = $(this).find('div.title_info').text();

if (!artist) {
artist = albumArtist;
}

artist = $.trim(artist);
song = $.trim(song);

if (artist && song) {
Playgrub.playlist.add_track(artist, song);
}
});
}

Playgrub.source.start();
33 changes: 33 additions & 0 deletions scrapers/youtube.com.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* YouTube.com Playgrub Scraper
* Created by: Niall Smart <niall AT pobox DOT com>
* Version: 0.1
*
* Notes:
*
* This scraper will work on YouTube Disco and YouTube playlist pages (in "Play All" mode)
*/
Playgrub.source.url = 'http://.*\.youtube.com.*';
Playgrub.source.error = 'Check YouTube page - no playlist found.'
Playgrub.source.scrape = function() {

var addByTitle = function(title) {
var title = $(this).attr("title").split(" - ")
var artist = title[0];
var song = title[1];

if (artist && song) {
Playgrub.playlist.add_track(artist, song);
}
}

/* regular playlist */

$("#playlist-bar .playlist-bar-item a[title]").each(addByTitle);

/* cosmic panda playlist */

$("#watch-tray-playlist .watch-tray-playlist-item a[title]").each(addByTitle);
}

Playgrub.source.start();