Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save moalex/4aa15d3b0de27941bc1bf5b82bdb7e36 to your computer and use it in GitHub Desktop.

Select an option

Save moalex/4aa15d3b0de27941bc1bf5b82bdb7e36 to your computer and use it in GitHub Desktop.

Clean Youtube Watch Later

22.11.2022

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.

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