Skip to content

Instantly share code, notes, and snippets.

@aaditkamat
Last active October 2, 2023 23:52
Show Gist options
  • Save aaditkamat/89838f58de8684e2d489d9d06126dad4 to your computer and use it in GitHub Desktop.
Save aaditkamat/89838f58de8684e2d489d9d06126dad4 to your computer and use it in GitHub Desktop.
Script to mass unsubscribe from all YouTube channels
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 + " unsubscribed and " + els.length + " remaining");
}
@aaditkamat
Copy link
Author

Got this script from Saintlad.

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