Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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.

@itismartin

This comment has been minimized.

Copy link

@itismartin itismartin commented Oct 10, 2018

Works well! :)

@rachmadaniHaryono

This comment has been minimized.

Copy link

@rachmadaniHaryono rachmadaniHaryono commented Feb 3, 2019

that doesn't work on the given link, but work on this

https://www.youtube.com/playlist?list=WL&disable_polymer=true

@gpeterkin

This comment has been minimized.

Copy link

@gpeterkin gpeterkin commented Mar 18, 2019

Thank you for this! Extremely helpful with my 3k plus videos.

@bryancasler

This comment has been minimized.

Copy link

@bryancasler bryancasler commented Jul 22, 2019

that doesn't work on the given link, but work on this

https://www.youtube.com/playlist?list=WL&disable_polymer=true

Confirmed that the code is still working on this page. As others have said, thank you!

@bryancasler

This comment has been minimized.

Copy link

@bryancasler bryancasler commented Oct 1, 2019

Old code stopped working, now I'm using the following on https://www.youtube.com/playlist?list=WL&disable_polymer=true

javascript: var timer = window.setInterval(function() { var videoDeleteButton = document.querySelector('.pl-video-edit-remove'); if (videoDeleteButton) { videoDeleteButton.click(); setTimeout(function() { document.querySelector('.yt-uix-load-more').click(); }, 5000); } else { window.clearInterval(timer); } }, 1000);

@tumGER

This comment has been minimized.

Copy link

@tumGER tumGER commented May 3, 2020

Literal lifesaver. Thank you :)

@justingwl

This comment has been minimized.

Copy link

@justingwl justingwl commented Jul 26, 2020

nice!

@CarlosGS

This comment has been minimized.

Copy link

@CarlosGS CarlosGS commented Aug 20, 2020

In case you want to also clear your youtube live stream messages or live comments: https://gist.github.com/CarlosGS/ee39161c155b07f19c1b07675e396670

@johan456789

This comment has been minimized.

Copy link

@johan456789 johan456789 commented Aug 23, 2020

Works like a charm!

@RazvanFarte

This comment has been minimized.

Copy link

@RazvanFarte RazvanFarte commented Sep 5, 2020

Still works on chrome 85, thanks! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.