Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rip747/8a2a67447de23784a5f736574676d398 to your computer and use it in GitHub Desktop.
Save rip747/8a2a67447de23784a5f736574676d398 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];
    
    if (video === undefined) {
        return;
    }

    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();
    }
}, 1000);

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

@rip747
Copy link
Author

rip747 commented Aug 26, 2023

add exit if video is undefined. also up the interval to 1 second as I saw the original setting of 500ms failing.

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