Created
January 4, 2018 20:20
-
-
Save rppowell-lasfs/5632cfc3780be34e94ddbaf0301d756e to your computer and use it in GitHub Desktop.
javascript youtube likes/dislikes
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
javascript:(function(){ | |
var buttons = document.querySelectorAll('#menu ytd-toggle-button-renderer button.style-scope.yt-icon-button'); | |
var likes = buttons[0].attributes["aria-label"].nodeValue; | |
var dislikes = buttons[1].attributes["aria-label"].nodeValue; | |
var regex = /[\d,.]+/; | |
likes = likes.match(regex); | |
dislikes = dislikes.match(regex); | |
alert("Likes: " + likes + "\nDislikes: " + dislikes); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment