Skip to content

Instantly share code, notes, and snippets.

@aavezel
Created December 21, 2021 11:16
Show Gist options
  • Save aavezel/0a4c9e53024e1bb75ac07561dd7538d9 to your computer and use it in GitHub Desktop.
Save aavezel/0a4c9e53024e1bb75ac07561dd7538d9 to your computer and use it in GitHub Desktop.
Unsubsribe all channals of youtube
/*
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