Skip to content

Instantly share code, notes, and snippets.

@alane019
Last active January 18, 2025 21:42
Show Gist options
  • Save alane019/4eb230477f6b495d0235b72f318bbfc3 to your computer and use it in GitHub Desktop.
Save alane019/4eb230477f6b495d0235b72f318bbfc3 to your computer and use it in GitHub Desktop.
Delete remove all videos from Youtube "Watch Later" playlist (working as of 12/14/2020)
// This script can be used to clear all videos from youtube's built-in "watch later" playlist which has a limit of 5,000 videos.
// Without this, you would need to click the remove button on each video in the list.
// Youtube made changes recently that caused errors for a previously working script.
// Script written by: janthedeveloper (https://github.com/JanTheDeveloper)
// Bookmark wrapper added by: shelldonhull (https://github.com/sheldonhull)
// Full conversation here: https://gist.github.com/astamicu/eb351ce10451f1a51b71a1287d36880f#file-readme-md
// 1. Save the javascript text below as a bookmark in google chrome(Simply replace the URL field in any existing bookmark, and give the bookmark any name)
javascript:(() => {setInterval(function () { document.querySelector('#primary button[aria-label="Action menu"]').click(); var things = document.evaluate( '//span[contains(text(),"Remove from")]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ); for (var i = 0; i < things.snapshotLength; i++) { things.snapshotItem(i).click(); }}, 1000); })();
// 2.) Enter this exact URL into google chrome web browswer: https://www.youtube.com/playlist?list=WL&disable_polymer=true
// NOTE 1: THE URL MUST END WITH "&disable_polymer=true"
// NOTE 2: You'll need to be signed into your youtube account when using this URL, if you're not already.
// 3.) Once you're on the correct Watch Later playlist page, click the bookmark that you saved in the step 1. This will start deleting videos.
// Source: https://gist.github.com/astamicu/eb351ce10451f1a51b71a1287d36880f#gistcomment-3552367 (as of 12/14/2020)
// You can save any javascript snippet as a bookmark and run as needed using this format:
// javascript:(() => { REPLACE_THIS_TEXT_WITH_SCRIPT })();
// If page is being displayed in language other than English, see comment from Gater73 below. Update portions on html tags that vary based on language.
// Full script, without the bookmark wrapper code below (This could be entered into the chrome dev-tools console as an alternative to using the bookmarked script)
setInterval(function () {
document.querySelector('#primary button[aria-label="Action menu"]').click();
var things = document.evaluate( '//span[contains(text(),"Remove from")]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
for (var i = 0; i < things.snapshotLength; i++) {
things.snapshotItem(i).click();
}
}, 1000);
@mtunad
Copy link

mtunad commented Jul 31, 2023

@ArthurYdalgo 's code works well, without throwing into 5xx errors. Thanks

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