Skip to content

Instantly share code, notes, and snippets.

@SuhairZain
Last active October 16, 2016 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SuhairZain/0a4a94d649c2aa4ee26b17b401a2d04f to your computer and use it in GitHub Desktop.
Save SuhairZain/0a4a94d649c2aa4ee26b17b401a2d04f to your computer and use it in GitHub Desktop.
I granted Twitter permission to some app which automatically followed random people and I wanted to unfollow all of them at once.
First of all, to prevent something like this happening again, review the apps you have permitted at https://twitter.com/settings/applications and remove the ones you suspect.
Login and open your following page at https://twitter.com/USERNAME/following and scroll down until you reach the people you actually followed.
Open Developer Console (Web Console in Firefox - Ctrl + Shift + K) or (Developer Tools in Chrome - Ctrl + Shift + J).
Paste the following line of code and press enter. It finds the buttons (both follow and unfollow) and clicks them one by one. Note that your browser may show an unresponsive script dialog. Choose continue.
Array.from(document.getElementsByClassName("user-actions-follow-button js-follow-btn follow-button btn small small-follow-btn")).forEach((button) => {button.click()})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment