Following users is a fundamental concept on Twitter. Replacement APIs for the following v1.1 endpoint has recently been shipped:
The above have been replaced with the Follows Lookup API. At the time of writing this API contains two new endpoints:
The first gives you a list of who an account is following. The second gives you a list of an account’s followers.
Social Opinion API
I’ve integrated both these endpoints in version 2.0.3 of the Social Opinion API. You can use this to extract following and follower data in 2 lines of code.
An Example
In this example we are extracting 100 followers:
UserService myUserService = new UserService(oAuthInfo); FollowersModel followers = myUserService.GetFollowers("958676983", "100", null);
The first parameter is the twitter id of the account we want to get followers for. The second is the number of followers and the final parameter is the page id.
Note: GetFollowing is the other method and uses the same parameters
Examining the Debugger
We can take a closer look at the debugger and see some of the follower data that we have access to. We can see we have a collection the contains 100 followers:
We can expand these and see we have a rich collection of objects that contain further insights about your followers on Twitter.
Here we can see the bio description:
We can also see mentioned accounts, location and metrics in the follower bio:
Other data points include URLs, Context Annotations and more.
Summary
In this blog post we’ve seen how you can use the Social Opinion API to extract follower and following data in a few lines of code. The API is available from https://developer.twitter.com and NuGet.
Leave a Reply