Skip to content

Instantly share code, notes, and snippets.

@aoqia194
Last active June 1, 2024 10:55
Show Gist options
  • Save aoqia194/d4bd3fb8ff7e5e8e37aca13f28d5c82f to your computer and use it in GitHub Desktop.
Save aoqia194/d4bd3fb8ff7e5e8e37aca13f28d5c82f to your computer and use it in GitHub Desktop.
A really bad mass YouTube channel unsubscriber!
var i = 0;
var intval = setInterval(unsubscribeFromChannel, 1000);
function unsubscribeFromChannel() {
let gridContainer = document.getElementById("grid-container");
let channelShelf = gridContainer.getElementsByClassName("ytd-expanded-shelf-contents-renderer");
if (i < channelShelf.length) {
channelShelf[i].querySelector("[aria-label^='Current setting is ']").click();
// Click unsubscribe entry in listbox
let paperListbox = document.getElementsByTagName("tp-yt-paper-listbox")[0];
paperListbox.children[3].click();
// Click unsubscribe button in confirmation popup
let confirmPopup = document.getElementsByTagName("yt-confirm-dialog-renderer")[0];
confirmPopup.querySelector("[aria-label='Unsubscribe']").click();
}
i++;
console.log("Unsubscribed from " + i + "channels.\n");
console.log(channelShelf.length + " channels remaining.");
}
@aoqia194
Copy link
Author

aoqia194 commented Jun 1, 2024

Go to https://youtube.com/feed/channels/ and paste script into browser console.

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