Skip to content

Instantly share code, notes, and snippets.

@csmatt
Created March 16, 2018 17:18
Show Gist options
  • Save csmatt/f46d969fef32dacff231aa7a8bab0856 to your computer and use it in GitHub Desktop.
Save csmatt/f46d969fef32dacff231aa7a8bab0856 to your computer and use it in GitHub Desktop.
Newer script to pull thumbs ups from Pandora. Can't seem to get past 100 or so songs :/
var doc = document, titlesAndArtists = new Set();
var scrollIntervalMs = 500;
var thumbsUpCount = doc.querySelector(".ProfileNav__count").textContent;
var scrollInterval = window.setInterval(function() {
if (titlesAndArtists.size < thumbsUpCount) {
var prevCount = titlesAndArtists.size;
doc.querySelectorAll(".UserProfile__ThumbUps__list .UserProfile__ThumbUps__list__item").forEach((e) => {
var song = doc.querySelector(".MediaListItem__primaryText", e).textContent;
var artist = doc.querySelector(".MediaListItem__secondaryText", e).textContent;
titlesAndArtists.add(song + " - " + artist);
if (titlesAndArtists.size > prevCount) {
console.log(song + " - " + artist);
console.log(titlesAndArtists.size);
}
});
//console.log(titlesAndArtists.size);
window.scrollBy(0,100);
} else {
window.clearInterval(scrollInterval);
titlesAndArtists.forEach((e) => {
console.log(e);
});
}
}, scrollIntervalMs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment