Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save olivoil/52d31be645ad8eb108e7d6a3c6a3da7d to your computer and use it in GitHub Desktop.
Save olivoil/52d31be645ad8eb108e7d6a3c6a3da7d to your computer and use it in GitHub Desktop.
Script to remove all videos from Youtube Watch Later playlist

UPDATED 3.12.2020

The old version of youtube with "disable_polymer" is not working anymore, so the script also stopped working.

Thanks to JanTheDeveloper we have a new working script. Big up!

I just changed the '//span[contains(text(),"Watch later")]', to '//span[contains(text(),"Remove from")]', and it should work for any playlist, not just the watch later one. (thanks to hudsonite for the tip)

setInterval(function () {
  document.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);

I moved the old working code to another gist

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