Skip to content

Instantly share code, notes, and snippets.

@quixoten
Last active October 6, 2015 02:18
Show Gist options
  • Save quixoten/2918953 to your computer and use it in GitHub Desktop.
Save quixoten/2918953 to your computer and use it in GitHub Desktop.
Print a list of all thumbed up tracks from a "Station details" page on Pandora.
/*
* 1. Copy the code below
* 2. Go to a Station details page using the Chrome browser, e.g., http://www.pandora.com/station/223075254154832821
* 3. CTRL+SHIFT+J
* 4. CTRL+V
* 5. ENTER
*
* It could take a while depending on how many tracks you've thumbed up
**/
(function ($) {
var printTracks, showMore;
printTracks = function () {
var count = 0
, tracks = []
;
$('.thumb_up_list .col1').each(function () {
var $this = $(this)
, artist = $(this).find('h3 > a:last-child').text()
, title = $(this).find('h3 > a:first-child').text()
;
tracks.push(artist + ' — ' + title)
count++
})
tracks.sort(function (a,b) {
var re = /^(the|a)\s+/i
return a.replace(re, '').localeCompare(b.replace(re, ''))
}).forEach(function (track) {
console.log(track)
})
console.log('Total tracks: ' + count);
}
showMore = function () {
var $showMore = $('.thumb_up_list .show_more:visible');
if ($showMore.length == 1) {
$showMore.click()
setTimeout(showMore, 1000)
} else {
printTracks()
}
}
console.log('Loading all thumbed up tracks…')
showMore();
})(jQuery)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment