Skip to content

Instantly share code, notes, and snippets.

@lesleh
Last active September 10, 2019 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lesleh/a91b2674ad43bd83da12be778b7760e3 to your computer and use it in GitHub Desktop.
Save lesleh/a91b2674ad43bd83da12be778b7760e3 to your computer and use it in GitHub Desktop.
Delete watched YouTube videos from Watch Later. Only tested on the old layout.
const findVideos = () => [...document.querySelectorAll('.pl-video')];
const watchedGreaterThanHalf = (video) => {
const progressBar = video.querySelector('.resume-playback-progress-bar');
return progressBar && parseInt(progressBar.style.width) > 50;
}
const removeButton = (video) => x.querySelector('.pl-video-edit-remove');
const click = (button) => button.click();
findVideos()
.filter(watchedGreaterThanHalf)
.map(removeButton)
.forEach(click);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment