Created
February 2, 2023 08:13
-
-
Save Om-Thorat/a74bf83b52d669b19311325b35d7440c to your computer and use it in GitHub Desktop.
Clean the youtube Watch Later playlist by removing the videos you have watched!
This file contains 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
var WList = document.querySelector("#contents").querySelector("#contents").querySelector("#contents").children | |
console.log(WList.length) | |
function sleep(ms) {return new Promise(resolve => setTimeout(resolve, ms));} | |
console.log("Starting...") | |
removed = []; | |
async function clean() { | |
for (let i = 0; i < WList.length; i++) { | |
const vid = WList[i]; | |
var prog = vid.children[1].querySelector("#container #thumbnail #thumbnail #overlays #progress"); | |
if (prog != null) { | |
if (Number(prog.style.width.slice(0, -1)) >= 90) { | |
console.log("watched"); | |
removed.push(vid.children[1].querySelector("#container #thumbnail #thumbnail").href); | |
vid.children[2].querySelector("#button #button").click(); | |
await sleep(500) | |
document.querySelector("ytd-popup-container #contentWrapper #items").children[2].click(); | |
await sleep(500) | |
i = i - 1 | |
} | |
} | |
} | |
console.log(removed) | |
console.log("done!") | |
} | |
clean() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Get the Firefox Add-on Here