Skip to content

Instantly share code, notes, and snippets.

@airways
Last active September 3, 2021 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save airways/f2436822898cb5a948d1fb165b676e40 to your computer and use it in GitHub Desktop.
Save airways/f2436822898cb5a948d1fb165b676e40 to your computer and use it in GitHub Desktop.
Remove all youtube subscriptions
/*
* Instructions:
* 1) Go to https://www.youtube.com/feed/channels
* 2) Right click and click Inspect
* 3) Click Console tab
* 4) Paste the snippet below.
* 5) Keep page open until you see "Done" in a dialog box.
* 6) You may need to refresh the page and paste the snippet again. Sometimes it can't get them all beacuse of how YouTube loads the list.
*/
var subs = Array.from(document.getElementsByClassName('ytd-subscribe-button-renderer'));
var unsubbed = {}
function unsubNext() {
if(subs.length == 0) {
alert('Done! Please refresh the page to verify that all subscriptions are gone and re-run the snippet if not!');
} else {
var sub = subs.shift();
if(sub.getAttribute('aria-label')) {
// Click unsubscribe
console.log('unsub... about '+(subs.length/4)+' left...')
console.log(sub)
sub.click();
// Confirm in popup
setTimeout(function() {
console.log('confirm');
document.getElementById('confirm-button').click();
}, 100);
setTimeout(unsubNext, 300);
} else {
setTimeout(unsubNext, 100);
}
}
}
setTimeout(unsubNext, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment