Originally By @foldleft.bsky.social, see also Unfollow everyone on bsky.app.
Go to https://twitter.com/YOUR_USER_NAME/following
Open the Developer Console. (COMMAND+ALT+I on Mac)
Paste this into the Developer Console and run it// Remove all follows on twitter.com
// Based on script by Jamie Mason (https://twitter.com/fold_left)
// https://gist.github.com/JamieMason/7580315
//
// 1. Go to https://twitter.com/YOUR_USER_NAME/followers
// 2. Open the Developer Console. (COMMAND+ALT+I on Mac)
// 3. Paste this into the Developer Console and run it
//
(() => {
const $moreButtons = '[aria-label="More"]';
const $removeButton = '[data-testid="removeFollower"]';
const $confirmButton = '[data-testid="confirmationSheetConfirm"]';
const retry = {
count: 0,
limit: 3,
};
const scrollToTheBottom = () => window.scrollTo(0, document.body.scrollHeight);
const retryLimitReached = () => retry.count === retry.limit;
const addNewRetry = () => retry.count++;
const sleep = ({ seconds }) =>
new Promise((proceed) => {
console.log(`WAITING FOR ${seconds} SECONDS...`);
setTimeout(proceed, seconds * 1000);
});
const removeAll = async (moreButtons) => {
console.log(`REMOVING ${moreButtons.length} FOLLOWERS...`);
for (const moreButton of moreButtons) {
// Click the "More" button
moreButton && moreButton.click();
await sleep({ seconds: 0.5 });
// Click "Remove this follower"
const removeButton = document.querySelector($removeButton);
removeButton && removeButton.click();
await sleep({ seconds: 0.5 });
// Confirm removal
const confirmButton = document.querySelector($confirmButton);
confirmButton && confirmButton.click();
await sleep({ seconds: 0.5 });
}
};
const nextBatch = async () => {
scrollToTheBottom();
await sleep({ seconds: 1 });
const moreButtons = Array.from(document.querySelectorAll($moreButtons));
const moreButtonsWereFound = moreButtons.length > 0;
if (moreButtonsWereFound) {
await removeAll(moreButtons);
await sleep({ seconds: 2 });
retry.count = 0; // Reset retry count on success
return nextBatch();
} else {
addNewRetry();
}
if (retryLimitReached()) {
console.log(`NO MORE FOLLOWERS FOUND, SO I THINK WE'RE DONE`);
console.log(`RELOAD PAGE AND RE-RUN SCRIPT IF ANY WERE MISSED`);
} else {
await sleep({ seconds: 2 });
return nextBatch();
}
};
nextBatch();
})();