Skip to content

Instantly share code, notes, and snippets.

@tacohitbox
Last active February 13, 2022 03:25
Show Gist options
  • Save tacohitbox/cd1875e537e46d38c63b2251f013520a to your computer and use it in GitHub Desktop.
Save tacohitbox/cd1875e537e46d38c63b2251f013520a to your computer and use it in GitHub Desktop.
Bulk unfollow Twitter accounts for free.

To do: write actual documentation on how to use it.

For now, if you know how to paste code into DevTools. Paste this on your following page and it should do it.

If your username is @balls, go to https://twitter.com/balls/following and paste this code into DevTools.

I take no responsibility for rate limits, but I unfollowed 1k people on an alt without an issue.

function refresh() {
  var btns = document.querySelectorAll("[data-testid]")
  var followBtns = Array.from(btns).filter(btn => {
    return btn.getAttribute('data-testid').includes('unfollow')
  });
  unfollow(followBtns);
}

function unfollow(followBtns) {
  for (let i = 1; i <= followBtns.length; i++) {
    setTimeout(() => {
      followBtns[i - 1].scrollIntoView();
      followBtns[i - 1].click();
      setTimeout(function() {
        if (document.querySelector("div[data-testid='confirmationSheetConfirm']"))  document.querySelector("div[data-testid='confirmationSheetConfirm']").click();
        if (i == (followBtns.length - 1)) {refresh()}
      }, 10);
    }, 100 * i);
  }
}

refresh();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment