Skip to content

Instantly share code, notes, and snippets.

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

UPDATE 17.10.2019

Only works on old youtube skin.

//added "&disable_polymer=true" after playlist link

Also, saw this now, there is a "remove watched" button.

  1. Open your watch later playlist on youtube.
  2. Open the development console for your browser ( Ctrl+Shift+J for chrome, Ctrl+Shift+K for firefox )
  3. paste this script into the console
window.ginterval = 0;

const openMenu = () => {
	// Open Video Menu
	document.querySelector('.ytd-playlist-video-list-renderer button.yt-icon-button>yt-icon.ytd-menu-renderer').click();

	// Delay untill the button shows up
	setTimeout(deleteFromMenuLoop, 180)
}

const deleteFromMenu = () => {	
    // Find the delete button
    let deleteButton = Array.from(document.querySelectorAll(".ytd-menu-popup-renderer>.ytd-menu-service-item-renderer"))
        .find(elem => (elem.innerText === "Remove from Watch later"))

    if (deleteButton) {
        deleteButton.click();
        window.ginterval++;
        console.log(window.ginterval);
    }
}

const deleteFromMenuLoop = () => {
	deleteFromMenu();
	window.timer = setTimeout(openMenu, 400);
}


// Detect a stale/empty page
window.check = setInterval(() => {
    if(window.ginterval === window.ginterval_two) {
        // Count has stopped moving, auto stop interval
        window.clearInterval(timer);
    }
	else {
		window.ginterval_two = window.ginterval
	}
}, 10000);


openMenu();
  1. Press the enter key
  2. Watch your watch later playlist empty in realtime :D

If you need to stop the script simply close or refresh the playlist's tab in your browser.

I haven't tried, but this should work on other playlists as well.

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