Created
September 25, 2025 08:24
-
-
Save voltrevo/910ee0002f6abd22e75794806d4d20a2 to your computer and use it in GitHub Desktop.
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
list = document.querySelector('#contents').querySelector('#contents').querySelector('#contents'); | |
function openMenu() { | |
list.firstChild.querySelector('#menu').querySelector('button').click() | |
} | |
function findRemoveEl() { | |
const items = [...document.querySelector('tp-yt-paper-listbox#items').querySelectorAll('yt-formatted-string')]; | |
return items.find(i => i.textContent.includes('Remove from Watch Later')); | |
} | |
sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
openRemoveDelay = 100; | |
async function iter() { | |
openMenu(); | |
await sleep(openRemoveDelay); | |
findRemoveEl().click(); | |
} | |
countEl = 'todo'; // assign this to the 'x,xxx' videos element | |
async function smartIter() { | |
const startText = countEl.textContent; | |
await iter(); | |
while (true) { | |
if (countEl.textContent !== startText) { | |
break; | |
} | |
await sleep(50); | |
} | |
console.log(countEl.textContent); | |
} | |
async function smartIterLoop() { | |
while (countEl.textContent.trim() !== '3') { | |
const start = Date.now(); | |
await smartIter(); | |
console.log(Date.now() - start); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment