Created
April 25, 2017 23:52
-
-
Save shortstuffsushi/c9e67fcfdb08794685db4e22736788a6 to your computer and use it in GitHub Desktop.
Skip Google Music
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
// 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@glichtenstein
Use greasemonkey for firefox https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
or tampermonkey for chrome.