Created
December 21, 2021 11:16
-
-
Save aavezel/0a4c9e53024e1bb75ac07561dd7538d9 to your computer and use it in GitHub Desktop.
Unsubsribe all channals of youtube
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
/* | |
GO https://www.youtube.com/feed/channels | |
*/ | |
// https://stackoverflow.com/a/61511955/626898 | |
function waitForElm(selector) { | |
return new Promise(resolve => { | |
if (document.querySelector(selector)) { | |
return resolve(document.querySelector(selector)); | |
} | |
const observer = new MutationObserver(mutations => { | |
if (document.querySelector(selector)) { | |
resolve(document.querySelector(selector)); | |
observer.disconnect(); | |
} | |
}); | |
observer.observe(document.body, { | |
childList: true, | |
subtree: true | |
}); | |
}); | |
} | |
while (true) { | |
const sb = await waitForElm('#subscribe-button tp-yt-paper-button[subscribed]'); | |
sb.click(); | |
const confirmbutton = await waitForElm('#confirm-button a'); | |
confirmbutton.click(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment