Created
March 6, 2019 04:37
-
-
Save shortland/76d7d5cc94f1fb5f67dc3e78a5a6bcd1 to your computer and use it in GitHub Desktop.
Mass auto-unsub from YouTube
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // adapted & updated from: https://stackoverflow.com/questions/48874382/how-to-unsubscribe-from-all-the-youtube-channels-at-once/48874466#48874466 | |
| var i = 0; | |
| var myVar = setInterval(myTimer, 1000); | |
| function myTimer () { | |
| console.log("here we go!"); | |
| 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(); | |
| }, 1000); | |
| setTimeout(function () { | |
| try { | |
| els[i].parentNode.removeChild(els[i]); | |
| } catch (err) { | |
| alert("Error... Please refresh this page and start over"); | |
| } | |
| }, 1000); | |
| } | |
| i++; | |
| console.log(i + " unsubscribed successfully"); | |
| console.log(els.length + " remaining"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment