Skip to content

Instantly share code, notes, and snippets.

@dralletje
Created October 22, 2025 22:53
Show Gist options
  • Save dralletje/7241e2a3874eaef0bdc3db727db46bbd to your computer and use it in GitHub Desktop.
Save dralletje/7241e2a3874eaef0bdc3db727db46bbd to your computer and use it in GitHub Desktop.
async function removeVideos() {
let removed = 0;
while (true) {
const video = document.querySelector('ytd-playlist-video-renderer');
if (video == null) break;
console.log(`Processing video ${removed + 1}...`);
// Locate the menu button for the current video
const menuButton = video.querySelector('button#button[aria-label="Action menu"]');
if (menuButton == null) throw new Error("No menuButton found")
menuButton.click();
// Wait for menu to open
await new Promise(resolve => setTimeout(() => resolve(), 500))
// Locate the "Remove from Watch Later" option by matching text
const removeButton = Array.from(
document.querySelectorAll('tp-yt-paper-item.style-scope.ytd-menu-service-item-renderer')
).find(item => item.textContent.trim() === "Remove from Watch later");
if (removeButton == null) throw new Error("No removeButton found")
removeButton.click();
console.log(`Removed video ${removed + 1}`);
removed++;
}
console.log('Done!');
}
await removeVideos();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment