Skip to content

Instantly share code, notes, and snippets.

@Yugsolanki
Created June 14, 2025 19:05
Show Gist options
  • Select an option

  • Save Yugsolanki/001aaee1a9dc97eb7938f92805d23dc8 to your computer and use it in GitHub Desktop.

Select an option

Save Yugsolanki/001aaee1a9dc97eb7938f92805d23dc8 to your computer and use it in GitHub Desktop.
A small javascript script to remove multiple video from Watch Later
(async function removeFromWatchLater() {
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
// Get all buttons with correct label and class
const menuButtons = Array.from(document.querySelectorAll('button.style-scope.yt-icon-button[aria-label="Action menu"]'));
console.log(`Found ${menuButtons.length} action menu buttons`);
for (let i = 0; i < menuButtons.length; i++) {
try {
const button = menuButtons[i];
button.click();
await sleep(500); // Wait for menu popup to open
const menuItems = Array.from(document.querySelectorAll('ytd-menu-service-item-renderer'));
// Find the correct menu item that says "Remove from Watch later"
const removeBtn = menuItems.find(item =>
item.innerText.includes('Remove from') && item.innerText.includes('Watch later')
);
if (removeBtn) {
removeBtn.click();
console.log(`Item ${i + 1}: Removed from Watch later`);
} else {
console.warn(`Item ${i + 1}: "Remove from Watch later" not found`);
}
await sleep(1000); // Wait after removing
} catch (err) {
console.error(`Error processing item ${i + 1}:`, err);
}
}
console.log("Done processing all visible items.");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment