Skip to content

Instantly share code, notes, and snippets.

@leehambley
Last active March 8, 2025 15:38
Show Gist options
  • Save leehambley/0e14416c6a5ef4b7387997985ee7513a to your computer and use it in GitHub Desktop.
Save leehambley/0e14416c6a5ef4b7387997985ee7513a to your computer and use it in GitHub Desktop.
2025: Clear YouTube "Watch Later" Playlist

Known working on 2025-03-08, without any special suffixes or anything on the URL.

May be specific to english language, but I don't think so.

Instructions:

  • open the browser debug tools
  • navigate to console
  • (pay attention to instruction that may say "type 'allow pasting' to proceed")
  • paste the code below
  • don't close the tab.
(function(){
function deleteNext() {
const videoItem = document.querySelector('ytd-playlist-video-renderer');
if (!videoItem) {
console.log("No more videos found.");
return;
}
const menuButton = videoItem.querySelector('yt-icon-button.dropdown-trigger button[aria-label="Action menu"]');
if (!menuButton) {
console.log("Action menu button not found.");
return;
}
menuButton.click();
setTimeout(() => {
// Select the third menu item from the listbox (assumed to be "Remove from Watch Later")
const menuItem = document.querySelector('tp-yt-paper-listbox#items > ytd-menu-service-item-renderer:nth-of-type(3) tp-yt-paper-item');
if (menuItem) {
menuItem.click();
setTimeout(deleteNext, 1000);
} else {
console.log("Menu item not found, retrying...");
setTimeout(deleteNext, 500);
}
}, 500);
}
deleteNext();
})();
(function(){
function deleteNext() {
const videoItem = document.querySelector('ytd-playlist-video-renderer');
if (!videoItem) {
console.log("No more videos found.");
return;
}
const menuButton = videoItem.querySelector('yt-icon-button.dropdown-trigger button[aria-label="Action menu"]');
if (!menuButton) {
console.log("Action menu button not found.");
return;
}
menuButton.click();
setTimeout(() => {
const xpath = "//tp-yt-paper-item[.//yt-formatted-string[contains(., 'Remove from') and contains(., 'Watch Later')]]";
const menuItem = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
if (menuItem) {
menuItem.click();
setTimeout(deleteNext, 1000);
} else {
console.log("Menu item not found, retrying...");
setTimeout(deleteNext, 500);
}
}, 500);
}
deleteNext();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment