Skip to content

Instantly share code, notes, and snippets.

@shortstuffsushi
Created April 25, 2017 23:52
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shortstuffsushi/c9e67fcfdb08794685db4e22736788a6 to your computer and use it in GitHub Desktop.
Save shortstuffsushi/c9e67fcfdb08794685db4e22736788a6 to your computer and use it in GitHub Desktop.
Skip Google Music
// This script will monitor the Google Music page and skip songs you've already downvoted.
// Google doesn't do this automatically for some weird reason, so this hacks around that.
// Note that you're limited to somewhere around five skips per hour per station, so you
// can pretty quickly run into a scenario where this won't work. In the case that you want
// to stop the script, just run clearInterval(skipper) after this script.
var skipper = setInterval(function() {
// Grab the rating container (first of two with the same class)
var ratingContainer = document.getElementsByClassName('rating-container')[0];
// The down thumb is the middle element
var downThumbButton = ratingContainer.children[1];
// Get the "title" attribute from the button
var titleAttr = downThumbButton.attributes.title.textContent;
// Check if the title is prefixed with "Undo" in the case that you've already thumbed
var isDownThumbed = titleAttr.startsWith('Undo');
// If it is thumbed down, "click" the next / skip button
if (isDownThumbed) {
document.getElementById('player-bar-forward').click();
}
}, 5000);
@Paprikas
Copy link

@glichtenstein
Use greasemonkey for firefox https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
or tampermonkey for chrome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment