Skip to content

Instantly share code, notes, and snippets.

@ethaniel
Created May 8, 2025 19:48
Show Gist options
  • Save ethaniel/e97cabec05f4f879e8a660e24aa0d389 to your computer and use it in GitHub Desktop.
Save ethaniel/e97cabec05f4f879e8a660e24aa0d389 to your computer and use it in GitHub Desktop.
Remove deleted videos from Youtube playlists.
/*
Step 1. Go to Youtube Studio.
Step 2. Open your playlist (URL looks like: https://studio.youtube.com/playlist/ID/videos)
Step 3. Run the following command in your chrome console.
*/
async function clickAllRemoveButtons(delay = 1000) {
let buttons;
do {
buttons = Array.from(document.getElementsByClassName("remove-from-playlist-button"));
for (const button of buttons) {
button.click();
await new Promise(resolve => setTimeout(resolve, delay)); // Delay between clicks
}
// Wait a moment for new buttons to load
await new Promise(resolve => setTimeout(resolve, 500));
} while (buttons.length > 0);
}
clickAllRemoveButtons();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment