Skip to content

Instantly share code, notes, and snippets.

@rppowell-lasfs
Created January 4, 2018 20:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rppowell-lasfs/5632cfc3780be34e94ddbaf0301d756e to your computer and use it in GitHub Desktop.
Save rppowell-lasfs/5632cfc3780be34e94ddbaf0301d756e to your computer and use it in GitHub Desktop.
javascript youtube likes/dislikes
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