Tutorial Twitter

Unblock all blocked Twitter accounts at once

If you have blocked hundreds of accounts, unblocking them one by one takes a lot of time. But there is a quick and easy way to unblock them all at once. You don’t need to give any app write permissions to your account for it to work.

Short version:
Got to the blocked accounts setting page, scroll to the bottom and run
$('.user-actions-follow-button').click()
in the browser console.

Long version:

1. Go to the settings

On this page you see all accounts your are blocking at the moment:
https://twitter.com/settings/blocked

2. Open the Developer Tools

Quickest way: Press F12 on Windows/Linux or Command+Option+I on MacOS. Tested on Chrome and Firefox.
You can go through the menu as well. Firefox: Extras -> Web Developers. Chrome: Other Tools -> Developer Tools.

You should now see a new area in your browser. Either on the right side or on the bottom of the window.

3. Open the Browser Console

Either by pressing “Esc” or selecting it in the top menu of the developer tools. With the console you can execute any JavaScript commands.

4. Scroll to the bottom of the page

The command we will use to unblock all accounts only unblocks accounts, that are loaded on the page. Therefore we need to scroll to the bottom so Twitter loads all accounts. You can do that manually by holding the scroll bar to the bottom or you can use the following two commands.

Start automated scrolling:
var autoScroll = setInterval(() => window.scrollTo(0, document.body.scrollHeight),1000);
‘setIntervall’ executes the function we give it every 1000 milliseconds. windows.scrollTo scrolls to the end of the page. If the page got longer the next time (after 1 second) the command is executed, it will scroll further.
Stop automated scrolling:
clearInterval(autoScroll)
Once we reached the bottom, we want to stop the scrolling.

5. Unblock all accounts

Now that all accounts are loaded, we can unblock them ad once by executing the following code. Only execute this once!
$('.user-actions-follow-button').click()

Explanation of the code:
$ refers to jQuery. A JavaScript library we can access because Twitter uses it and therefore it’s available on the page.
('.user-actions-follow-button') selects all Elements with the class “user-actions-follow-button”. While the class refers to following, Twitter uses it for the unblock button as well. You can see this yourself, when you use the element selector. The class stays the same after unblocking and the buttons change into follow buttons. If you would run the command again, it would follow all accounts.
.click() clicks on all elements that were selected.

If you leave the .click(), you can see how many accounts it would unfollow. You can add .length instead to get a cleaner output. In my case it would be 3 accounts.

Done

If you have an questions feel free to leave a comment or ask me on Twitter.

1 comment Add New Comment

Leave a Reply

Your email address will not be published. Required fields are marked *