Skip to content

Instantly share code, notes, and snippets.

@alexander480
Last active November 30, 2021 02:43
Show Gist options
  • Save alexander480/7d43b8a5c12adf92633b3d574c1d439e to your computer and use it in GitHub Desktop.
Save alexander480/7d43b8a5c12adf92633b3d574c1d439e to your computer and use it in GitHub Desktop.
Remove all videos from YouTube playlist (including watch later).

Clear YouTube Playlist

  1. Follow this specific YouTube link.
  2. Select playlist.
  3. Open developer console.
  4. Paste code into console.
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);

Credit to astamicu & JanTheDeveloper.

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