Skip to content

Instantly share code, notes, and snippets.

@metanomial
Created October 14, 2019 01:32
Show Gist options
  • Save metanomial/39042ae12273cecc2c05482046ae6c29 to your computer and use it in GitHub Desktop.
Save metanomial/39042ae12273cecc2c05482046ae6c29 to your computer and use it in GitHub Desktop.
Systematically like all YouTube videos in a playlist. Watch out for autoplay
// Skip delay in milliseconds
// Raise if your connection is slow
const delay = 8000;
function autolike() {
const likeButton = document.querySelector('button[aria-label^=like]')
const nextButton = document.querySelector('.ytp-next-button')
if(!isSelected(likeButton)) likeButton.click()
nextButton.click();
setTimeout(autolike, delay)
}
function isSelected(button) {
const icon = button.querySelector('.yt-icon');
const fill = window.getComputedStyle(icon).fill;
return fill == 'rgb(62, 166, 255)';
}
autolike()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment