Skip to content

Instantly share code, notes, and snippets.

@bored-engineer
Created September 17, 2014 19:13
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 bored-engineer/1edd4badaf7d01e7f8e8 to your computer and use it in GitHub Desktop.
Save bored-engineer/1edd4badaf7d01e7f8e8 to your computer and use it in GitHub Desktop.
Grabs the list of all thumbed up songs on Pandora.
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);
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);
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