Skip to content

Simple script to paste in console to remove all watched videos from Watch Later playlist (bypassing 502 error). Updated on July 2023.

Notifications You must be signed in to change notification settings

unpublishedworks/yt-remove-watched-videos

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 

Repository files navigation

Remove Watched Videos from Youtube Watch Later playlist

Currently, most Youtube users are unable to remove watched videos from their Watch Later playlist using the 'Remove Watched Videos' button. This becomes a problem once users reach the maximum playlist size of 5000 videos and would otherwise have to manually remove videos from their playlist.

This simple console script will remove all fully watched videos from Watch Later playlist, bypassing the 502 error by removing each video individually.

  1. Go to your Watch Later playlist
  2. Open Developer Console pressing F12 or CTRL + SHIFT + I
  3. Paste the following code in the console and press Enter:
setInterval(function () {
  watchedVideo = document.querySelector(`ytd-thumbnail-overlay-resume-playback-renderer > div.style-scope[style="width: 100%;"]`).closest('#content')
  watchedVideoMenu = watchedVideo.nextElementSibling
  watchedVideoMenu.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);


If you would also like to remove partially watched videos from the Watch Later playlist, you can use the following script (does not check for width: 100% on the 'resume-pĺayback' progress bar):

setInterval(function () {
  watchedVideo = document.querySelector(`ytd-thumbnail-overlay-resume-playback-renderer`).closest('#content')
  watchedVideoMenu = watchedVideo.nextElementSibling
  watchedVideoMenu.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);

You might find that the script stops working, once it runs out of videos that have loaded. Here is a little code to scroll down the playlist and load more items.

setInterval(function() {
  window.scrollBy(0, window.innerHeight);
}, 3000);

Putting the last two into a single function.

setInterval(function () {
  watchedVideo = document.querySelector(`ytd-thumbnail-overlay-resume-playback-renderer`).closest('#content')
  watchedVideoMenu = watchedVideo.nextElementSibling
  watchedVideoMenu.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();
  }
window.scrollBy(0, window.innerHeight);
}, 1000);

About

Simple script to paste in console to remove all watched videos from Watch Later playlist (bypassing 502 error). Updated on July 2023.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published