Skip to content

Instantly share code, notes, and snippets.

@sdawood
Last active June 29, 2023 00:05
Show Gist options
  • Select an option

  • Save sdawood/87729ed43be541cb6851d2237467adf1 to your computer and use it in GitHub Desktop.

Select an option

Save sdawood/87729ed43be541cb6851d2237467adf1 to your computer and use it in GitHub Desktop.
How to remove all videos from Youtube Watch later list
/* Quoted from:
* https://www.alphr.com/delete-all-watch-later-videos-youtube/
* The above used xpath with a span, which doesn't work for Youtube as of June 2023
*/
setInterval(function () {
document.querySelector('#primary button[aria-label="Action menu"]').click();
var things = document.evaluate( '//yt-formatted-string[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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment