Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save karuppasamy/9ef615461f252db44463b80fb1705fea to your computer and use it in GitHub Desktop.

Select an option

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