Skip to content

Instantly share code, notes, and snippets.

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 stve/1814cd746acb76b41e66665c1581e452 to your computer and use it in GitHub Desktop.
Save stve/1814cd746acb76b41e66665c1581e452 to your computer and use it in GitHub Desktop.
Script to remove all videos from Youtube Watch Later playlist

UPDATE 17.10.2019

Only works on old youtube skin.

//added "&disable_polymer=true" after playlist link

Also, saw this now, there is a "remove watched" button.

  1. Open your watch later playlist on youtube.
  2. Open the development console for your browser ( Ctrl+Shift+J for chrome, Ctrl+Shift+K for firefox )
  3. paste this script into the console
var interval = setInterval(removeOne, 30) // execute removeOne() every 30 milliseconds

var lastNumVideos = 0 // the number of displayed videos in the last execution of removeOne()

function removeOne () {
  var numVideos = document.querySelectorAll('.pl-video-edit-remove').length // number of videos displayed
  if (numVideos === lastNumVideos) {
    return // skip removal if the previously removed video is still present
  }
  if (numVideos < 1) {
    try {
      document.querySelector('.browse-items-load-more-button').click() // click load more if there are no displayed videos
    } catch (err) {
      console.log('Load More button is missing. Refresh the page and restart the script to remove more videos.')
      clearInterval(interval) // stop repeating removeOne()
    }
  } else {
    document.querySelector('.pl-video-edit-remove').click() // remove top most video
    lastNumVideos = numVideos
  }
}
  1. Press the enter key
  2. Watch your watch later playlist empty in realtime :D

If you need to stop the script simply close or refresh the playlist's tab in your browser.

I haven't tried, but this should work on other playlists as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment