Thursday, April 4, 2013

Mining Twitter Followers


I recently posted on how you can use Twitter API developers tools to extract Twitter posts for data mining projects. I kept looking at the tools that Twitter makes available through API and found that one of the other features that it allows you to do is look up a user’s followers.  This can be a great tool for trying to group users based on the followers a user has.

Again you can use this tool in any search engine by a simple URL:

“://api.twitter.com/1/followers/ids.json?cursor=-1&screen_name=(inser the user name of the profile that you want to find the users for here)”

The limitations of this are that Twitter will only load 5000 followers at a time. For Twitter users that have more than 5000 followers, you can still get more than 5000 followers, you will just need to add and use the cursor function. In the above URL you see the cursor is set to -1. When this page loads, the bottom contains the following information:

"next_cursor":1266926330315775567,"next_cursor_str":"1266926330315775567","previous_cursor":-1327399186464802948,"previous_cursor_str":"-1327399186464802948"}”

Just change the cursor from -1 to the next cursor number and reload the URL and it will index to the next 5000 followers. You can keep going on like this till the next cursor reads 0. When it reads 0 that means that you are at the end of the followers list.

What loads from Twitter is a list of user ID’s. Here is an example:

“25797169,37792876,22439366,16049921,16564850,22490684,27653864”

You can then use Twitter’s user/lookup function to find out more information about the followers. Here the URL for user/lookup:



No comments:

Post a Comment