Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mohandarsi/93fb96a4d2f80615daa3f53da6c334ca to your computer and use it in GitHub Desktop.

Select an option

Save mohandarsi/93fb96a4d2f80615daa3f53da6c334ca to your computer and use it in GitHub Desktop.
A script that can be executed to unsubscribe all the YouTube channels at once.
var i = 0;
var myVar = setInterval(myTimer, 3000);
function myTimer() {
var els = document.getElementById("grid-container").getElementsByClassName("ytd-expanded-shelf-contents-renderer");
if (i < els.length) {
els[i].querySelector("[aria-label^='Unsubscribe from']").click();
setTimeout(function () {
var unSubBtn = document.getElementById("confirm-button").click();
}, 2000);
setTimeout(function () {
els[i].parentNode.removeChild(els[i]);
}, 2000);
}
i++;
console.log(i + " Channels Unsubscribed\n");
console.log(els.length + " remaining");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment