Skip to content

Instantly share code, notes, and snippets.

@seliopou
Last active Nov 17, 2015
Embed
What would you like to do?
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