Last active
October 6, 2015 02:18
-
-
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.
This file contains hidden or 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
| /* | |
| * 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