Created
August 24, 2023 18:00
-
-
Save goodevilgenius/633278374ffa2f8438e275dcede4f9db to your computer and use it in GitHub Desktop.
Empty a YouTube playlist
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 clickRemove() { | |
const button = [...document.querySelectorAll('.yt-formatted-string')].find(el => el.innerText === 'Remove from '); | |
if (!button) { | |
console.log("Can't find remove button"); | |
return; | |
} | |
button.click(); | |
setTimeout(emptyList, 1); | |
} | |
function emptyList() { | |
const hamburger = document.querySelector('ytd-playlist-video-renderer button[aria-label="Action menu"]'); | |
if (!hamburger) { | |
console.log("Can't find hamburger menu"); | |
return; | |
} | |
hamburger.click(); | |
setTimeout(clickRemove, 500); | |
} | |
emptyList(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment