AnulCavity
Trace Evidence Specialist
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
300 XP
- Log in to your YouTube account.
- Click on Subscriptions.
- Click on “Manage” in the top-right corner. (https://www.youtube.com/feed/channels)
- Inspect the page elements or simply find (F12) key in your keyboard and press it
- Then go to "console" and copy paste the following code then hit enter
/**
* Youtube bulk unsubsribe fn.
* Wrapping this in an IIFE for browser compatibility.
*/
(async function iife() {
// This is the time delay after which the "unsubscribe" button is "clicked"; Tweak to your liking!
var UNSUBSCRIBE_DELAY_TIME = 2
/**
* Delay runner. Wraps `setTimeout` so it can be `await`ed on.
* @ {Function} fn
* @ {number} delay
*/
var runAfterDelay = (fn, delay) => new Promise((resolve, reject) => {
setTimeout(() => {
fn()
resolve()
}, delay)
})
// Get the channel list; this can be considered a row in the page.
var channels = Array.from(document.getElementsByTagName(`ytd-channel-renderer`))
console.log(`${channels.length} channels found.`)
var ctr = 0
for (const channel of channels) {
// Get the subsribe button and trigger a "click"
channel.querySelector(`[aria-label^='Unsubscribe from']`).click()
await runAfterDelay(() => {
// Get the dialog container...
document.getElementsByTagName(`yt-confirm-dialog-renderer`)[0]
// and find the confirm button...
.querySelector(`#confirm-button`)
// and "trigger" the click!
.click()
console.log(`Unsubsribed ${ctr + 1}/${channels.length}`)
ctr++
}, UNSUBSCRIBE_DELAY_TIME)
}
})()
- If not all channels were unsubscribed to, refresh your page and do the same process again, and bingo, this is it.
Edited by Meep2018, 08 March 2022 - 02:04 AM.