Last active
November 17, 2015 23:05
-
-
Save seliopou/20002a09ae72b1441e8b to your computer and use it in GitHub Desktop.
Quick and dirty script to scrape a playlist from Rdio and print it to the console in a csv format.
This file contains 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
/* rdio_scrape.js | |
* | |
* Quick and dirty script to scrape a playlist from Rdio and print it to the | |
* console in a csv format. | |
* | |
* XXX NB TODO READ THIS: Playlists are loaded lazily by Rdio, so make sure | |
* that when you navigate to a new playlist page you scroll from beginning to end | |
* and back again, making sure that all the songs have been rendered on the way | |
* back up. | |
* | |
* Hopefully one day a streaming service that doesn't suck will be sustainable. | |
* Until then, remember the fallen: | |
* | |
* - Amie Street | |
* - Imeem | |
* - Rdio | |
* | |
* ... and countless others. | |
* | |
* http://rd.io/x/QGnUK1GcPQ/ | |
* | |
* Author: Spiros Eliopoulos (@seliopou) | |
*/ | |
tracks = []; | |
$('.tracklist .Track').each(function() { | |
var index = $('.index', this).text().trim(), | |
metadata = $('.info .metadata a', this), | |
artist = $(metadata[0]).attr('title'), | |
album = $(metadata[1]).attr('title'), | |
song = $('.info .name a', this).attr('title'); | |
tracks.push([index, artist, album, song]); | |
}) | |
tracks.sort(function(a, b) { return a[0] - b[0] }); | |
tracks = tracks.map(function(song) { return song.join(","); }); | |
console.log(tracks.join("\n")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment