Resolving Mutual Relationship (2 way follow)

Jun 24, 2014 at 10:33 PM
Hello,

Given a user, I'd like to get a list of their friends (people the user follows). Then, I'd like to iterate through the friends to determine if they follow the user.

This could work well if the number of friends and followers is pretty low. To keep this from getting out of hand, I'd also like to first determine how many friends and followers exist. For example, @BarackObama follows 650k and has 43.7 million followers. In a case like this, I'd like to know this up front and move on to another user.

Is there currently a way to do this in Tweetinvi?
Coordinator
Jun 30, 2014 at 7:38 PM
Hello there,

Sorry for taking so much time to reply to your post. I usually respond within hours but I have been working a lot lately.

Either way, you are going to be playing against the rate limits of Twitter. I have personally done such a program and the issue is that you will quickly have to wait for your rate limit to be reset. What I would advise is to request multiple user token and use these tokens in order to perform your requests.
// Get the number of followers
var user = User.GetUserFromScreenName("BarackObama");
var numberOfFollowers = user.FollowersCount;

// Get multiple follower users at once (BE CAREFUL WITH RATE LIMIT WITH THIS ONE!)
// Each 250 users = 1 token from the rate limit
var followers = User.GetFollowers(user, 5000);

// Get the rate limit
var rateLimitInfos = RateLimit.GetCurrentCredentialsRateLimits().UsersLookupLimit;
Please let me know if this helps.
Linvi