Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jordyvandomselaar/44f56e2051c942bdc3cd3cbab9ef2f85 to your computer and use it in GitHub Desktop.
Save jordyvandomselaar/44f56e2051c942bdc3cd3cbab9ef2f85 to your computer and use it in GitHub Desktop.
Go to https://www.youtube.com/feed/channels, scroll all the way to the bottom then run this script to clear all of your subscriptions.
const unSubscribe = () => {
Array.from(document.querySelectorAll("yt-formatted-string"))
.find(yfs => yfs.textContent === "Subscribed")
.click();
setTimeout(() => {
Array.from(document.querySelectorAll("yt-formatted-string"))
.filter(yfs => yfs.textContent === "Unsubscribe")
.forEach(yfs => yfs.click());
}, 400);
};
const amountOfSubscriptions = Array.from(document.querySelectorAll("yt-formatted-string"))
.filter(yfs => yfs.textContent === "Subscribed")
.length;
let currentSubscriptionNumber = 1;
const unSubScribeAll = () => {
setTimeout(() => {
unSubscribe();
console.log(`${amountOfSubscriptions - currentSubscriptionNumber} remaining.`);
currentSubscriptionNumber++;
unSubScribeAll();
}, 1000);
};
console.log(`Removing ${amountOfSubscriptions} subscriptions.`);
unSubScribeAll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment