Skip to content

Instantly share code, notes, and snippets.

@seliopou
Last active November 17, 2015 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seliopou/20002a09ae72b1441e8b to your computer and use it in GitHub Desktop.
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.
/* 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