Created
September 17, 2014 19:13
-
-
Save bored-engineer/1edd4badaf7d01e7f8e8 to your computer and use it in GitHub Desktop.
Grabs the list of all thumbed up songs on Pandora.
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
var results = {}; | |
var stations = prompt("Stations:", "").split(","); | |
function requestThumbs(i, index) { | |
var id = stations[i]; | |
if (!id) { console.log(results); return; } | |
console.log(id, index); | |
$.get( | |
"http://www.pandora.com/content/station_track_thumbs?stationId=" + id + "&page=true&posFeedbackStartIndex=" + index + "&posSortAsc=false&posSortBy=date&cachebuster%3A=" + new Date().getTime(), | |
function(data) { | |
var page = $("<div>" + data + "</div>"); | |
if (!results[id]) { results[id] = []; } | |
page.find("li").each(function(i, li) { | |
results[id].push($(li).find(".col1").find("h3").text()); | |
}); | |
if (page.find(".show_more").length == 0) { | |
requestThumbs(i + 1, 0); | |
} else { | |
requestThumbs(i, page.find("li").length + index); | |
} | |
} | |
); | |
} | |
requestThumbs(0, 0); |
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
var stations = $("#stationList").children().toArray(); | |
stations.shift(); | |
var stationIds = []; | |
function checkStation(i) { | |
if (!stations[i]) { console.log(stationIds); return; } | |
$(stations[i]).click(); | |
setTimeout(function() { | |
stationIds.push(window.location.href.split("/").pop()); | |
checkStation(i + 1); | |
}, 1000); | |
} | |
checkStation(0); |
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
var txt = ""; | |
$.each(results, function(i, songs) { | |
txt += i + ":\n\t" + songs.join("\n\t") + "\n"; | |
}); | |
copy(txt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment