Skip to content

Instantly share code, notes, and snippets.

@greatghoul
Created January 11, 2024 14:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save greatghoul/b71282a85883a6b9d2e670d3ab6048a9 to your computer and use it in GitHub Desktop.
Save greatghoul/b71282a85883a6b9d2e670d3ab6048a9 to your computer and use it in GitHub Desktop.
Batch Unsubscribe Youtube Channels
(function () {
function clickElement(element) {
return new Promise((resolve, reject) => {
const event = new MouseEvent("click", { bubbles: true, cancelable: true });
element.dispatchEvent(event);
setTimeout(() => resolve(element), 500);
});
}
async function start() {
const channel = document.querySelector("ytd-channel-renderer");
if (!channel) return;
const buttonLeave = channel.querySelector("ytd-subscribe-button-renderer .yt-spec-touch-feedback-shape__fill");
await clickElement(buttonLeave);
const buttonConfirm = document.querySelector("tp-yt-paper-dialog #confirm-button .yt-spec-touch-feedback-shape__fill");
await clickElement(buttonConfirm);
channel.remove();
setTimeout(start, 1000);
}
start();
})();
@greatghoul
Copy link
Author

1

@bestony
Copy link

bestony commented Jan 13, 2024

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment