Last active
March 8, 2017 20:40
-
-
Save CodeDraken/d55faa44000deae2458ee890b81c8880 to your computer and use it in GitHub Desktop.
Spotify Add / Favorite Script - use it in a playlist (like discover weekly) to add all songs to your collection
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
// Just press F12 in Chrome and paste code to console | |
// only works on pages that use .btn class only | |
var addButtons = document.querySelectorAll('tr:not(.added) .btn.btn-icon.btn-add:not(.added)'); | |
for (var i=0; i<addButtons.length; i++) { | |
addButtons[i].click() | |
} | |
// or use this | |
function favoriteAll() { | |
console.log('favoriting all'); | |
var addButtons = Array.prototype.slice.call(document.querySelectorAll('tr:not(.added) .button-icon-only.button-add:not(.added), tr:not(.added) .btn.btn-icon.btn-add:not(.added)')).filter(function(button) { | |
return button.dataset.logClick === 'add-button'; | |
}); | |
for (var i=0; i<addButtons.length; i++) { | |
addButtons[i].click(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment