Skip to content

Instantly share code, notes, and snippets.

@joeleonjr
Forked from nytr0gen/twitter_unfollower.js
Created June 2, 2021 10:42
Show Gist options
  • Save joeleonjr/dcefb8ec83bedfed6ac782435e9d08b3 to your computer and use it in GitHub Desktop.
Save joeleonjr/dcefb8ec83bedfed6ac782435e9d08b3 to your computer and use it in GitHub Desktop.
Twitter Nuclear Unfollow
// 1. Go to your Following page. Mine would be https://twitter.com/nytr0gen_/following
// 2. Run this script in the Console. Change maxUnfollows to anything you want.
// 3. Check in from time to time and run it again if it fails.
sendUnfollow = () => document.querySelector('[data-testid=UserCell] [data-testid*=unfollow] span span').click();
confirmUnfollow = () => document.querySelector('[data-testid=confirmationSheetConfirm] span span').click();
sleep = ms => new Promise(r => setTimeout(r, ms));
i = 0;
maxUnfollows = 1000;
recursiveUnfollow = () => {
if (i++ > maxUnfollows) { return; }
sendUnfollow();
sleep(200).then(() => {
confirmUnfollow();
window.scrollBy(0, 110);
return sleep(200);
}).then(() => recursiveUnfollow());
};
recursiveUnfollow();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment