- OPen youtube, change language to English
- Go to your watch later playlist
- OPen the inspect -> console
- Paste the script and execute it
-
-
Save rochacbruno/dbedf63aa4d4d2909323facd9a0dc334 to your computer and use it in GitHub Desktop.
Delete youtube watch later
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deleteVideoFromWatchLater() { | |
video = document.getElementsByTagName('ytd-playlist-video-renderer')[0]; | |
video.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(); | |
} | |
} | |
async function deleteWatchLater() { | |
let batchSize = 200; | |
let waitBetweenBatchesInMilliseconds = 1000 * 60 * 5 | |
let waitBetweenDeletionsInMilliseconds = 500; | |
let totalWaitTime = ((5000 / batchSize) * (waitBetweenBatchesInMilliseconds / 1000 / 60)) + (5000 * (waitBetweenDeletionsInMilliseconds / 1000 / 60)) | |
console.log(`Deletion will take around ${totalWaitTime.toFixed(0)} minutes to run if the playlist is full.`); | |
let count = 0; | |
while (true) { | |
await new Promise(resolve => setTimeout(resolve, waitBetweenDeletionsInMilliseconds)); | |
deleteVideoFromWatchLater(); | |
count++; | |
if (count % batchSize === 0 && count !== 0) { | |
console.log('Waiting for 5 minutes...'); | |
await new Promise(resolve => setTimeout(waitBetweenBatchesInMilliseconds)); | |
} | |
} | |
} | |
deleteWatchLater(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment