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).
<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.
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
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.