-
-
Save wilmoore/e42ebdfed996c319b62a6e306c581050 to your computer and use it in GitHub Desktop.
YouTube Unsubscribe (YTUNSUB)
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
(async function iife() { | |
const UNSUBSCRIBE_DELAY_TIME = 2000 | |
const runAfterDelay = (fn, delay) => new Promise((resolve, reject) => { | |
setTimeout(() => { | |
fn(); | |
resolve() | |
}, delay) | |
}) | |
const channels = Array.from(document.getElementsByTagName(`ytd-channel-renderer`)) | |
console.log(`${channels.length} channels found.`) | |
const ctr = 0 | |
for (const channel of channels) { | |
channel.querySelector(`[aria-label^='Unsubscribe from']`).click() | |
await runAfterDelay(() => { | |
document.querySelector('[aria-label="Unsubscribe"]').click() | |
console.log(`Unsubsribed ${ctr + 1}/${channels.length}`) | |
ctr++ | |
}, UNSUBSCRIBE_DELAY_TIME) | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment