Skip to content

Instantly share code, notes, and snippets.

@astamicu
Last active February 17, 2025 07:09
Show Gist options
  • Save astamicu/eb351ce10451f1a51b71a1287d36880f to your computer and use it in GitHub Desktop.
Save astamicu/eb351ce10451f1a51b71a1287d36880f to your computer and use it in GitHub Desktop.
Script to remove all videos from Youtube Watch Later playlist

UPDATED 22.11.2022

It's been two years since the last update, so here's the updated working script as per the comments below.

Thanks to BryanHaley for this.

setInterval(function () {
    video = document.getElementsByTagName('ytd-playlist-video-renderer')[0];

    video.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();
    }
}, 500);

Non-english users will need to change "Action menu" and "Remove from" to what YouTube uses for their localization.

@John-nata
Copy link

G'day everyone!

I’m stokedto announce a major update to my userscript "YT-Playlist-Cleaner", packed with some fantastic new features and improvements:

🌟 New Features: Welcome message, dark mode, smart retry, and usage stats.
🚀 Enhanced: Error handling, performance, and UI responsiveness.
🛠️ Added Functionality: Batch processing, config persistence, and a cleaner codebase.
🐛 Bug Fixes: Scrolling, deletion, and notification issues resolved.

This update makes the script more powerful and reliable than ever.
The script is fully open-source: feel free to fork it, tweak it, and make it your own!
Collaboration is what makes Github and coding so amazing, am I right?

image

Looking forward to hearing your thoughts!

Cheers!

@DUSK-D
Copy link

DUSK-D commented Feb 13, 2025

For french/france/français

setInterval(function () {
    video = document.getElementsByTagName('ytd-playlist-video-renderer')[0];

    video.querySelector('#primary button[aria-label="Menu d\'actions"]').click();

    var things = document.evaluate(
        '//span[contains(text(),"Supprimer de")]',
        document,
        null,
        XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
        null
    );

    for (var i = 0; i < things.snapshotLength; i++) 
    {
        things.snapshotItem(i).click();
    }
}, 500);

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