Skip to content

Instantly share code, notes, and snippets.

@ericlaw1979
Created January 19, 2023 20:25
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 ericlaw1979/35963fe6978668241bea7f411a0801b1 to your computer and use it in GitHub Desktop.
Save ericlaw1979/35963fe6978668241bea7f411a0801b1 to your computer and use it in GitHub Desktop.
Visit https://www.youtube.com/feed/channels and use the F12 Console tab to run this script
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.querySelector("[aria-label='Unsubscribe']");
console.dir(unSubBtn.outerHtml);
unSubBtn.click();
}, 600);
setTimeout(function () {
els[i].parentNode.removeChild(els[i]);
}, 1200);
}
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