Mastodon hachyterm.io

Bulk remove all clips from your playlist with a script

My YouTube “Watch Later” playlist contains more than 600 videos.

Every time something remotely interested me, I put it on that playlist. “I can always watch it later, when I have time.”

Unsurprisingly, I never had the time. Some of the clips are longer than one hour.

“Let’s delete all videos from my Watch Later playlist - tabula rasa.”

That’s a nice thought, but YouTube doesn’t allow you to bulk delete videos from a playlist.

I could live with manually clicking on the trash icon for a few clips, but over 600!?

Searching for a solution yielded some results from reddit, but they don’t work anymore as YouTube changed their interface.

A Script to Delete All Videos

I found a GitHub Gist that solves my problem.

  1. You have to switch to the old interface

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

  2. Open the developer tools of your browser

    For Firefox or Chrome: F12 or CTRL+Shift+I on Linux.

  3. Open the “Console” and paste this script:

    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)
    

    (edit: I updated this script in 2023 thanks to this blogpost).
    The script searches for the delete button and uses a timer to execute the delete function.

  4. Hit the Enter key to execute the script.

  5. Leave the browser window open until your playlist is empty.