Here’s a neat trick I found that allows you to follow in one action all the twitter users that are presented in a single page on twitter, you can use it on the search results or you can do it on the Followers or Following page of a given user.
I’m going to show you two similar ways, the first is a bit more simple and should be fine for most purposes, the second one is a bit more accurate, in the future you might have to modify them a little since Twitter might change their HTML a little (change names of CSS classes).
Twitter is using the jQuery JavaScript framework so you can call the click() function on all the Follow buttons for all of the users on that page, at the moment of writing this post every twitter Follow button code is:
<button class="user-actions-follow-button js-follow-btn follow-button btn small small-follow-btn" type="button"> ... </button>
You can see it’s using a few CSS classes, any one of them can be used to query for a list of all of the buttons.
Open the Twitter page you want to perform the mass follow, scroll down as much as you want to increase the number of users Twitter is displaying.
Now open your browser’s JavaScript console (usually CTRL+Shift+K or CTRL+Shift+J) and input the following jQuery code:
$('.user-actions-follow-button').click();
Note that in this example I’m using the user-actions-follow-button css class name, and that it’s prefixed by a dot to tell jQuery it’s a CSS class.
Once you hit Enter, all the Follow buttons will be clicked.
This method simply click every “Follow” button in the page, if you already follow a user in that page you will effectively click an “Unfollow” button for that user instead.
You can modify the query to only select the buttons for the users you are not following/pending approval and so on by using the following CSS selector
$('.follow-text:visible').parent().click();
We’re selecting a span inside the button object, if it’s of class .follow-text and it’s visible, we want it’s parent – The follow button and we perform click() on that button.