tags:

views:

73

answers:

1

Does anyone know how to use TweetSharp to get some account's follower count?

+1  A: 

You can get the friends and followers count from the TwitterUser object. To fetch a user directly:

 var twitter = FluentTwitter.CreateRequest()
            .Users().ShowProfileFor("jimbob").AsJson();

 var response = twitter.Request();
 var user = response.AsUser();
 Console.Writeline( "jimbob has {0} followers", user.FollowersCount);

User objects are also returned with individual TwitterStatus objects (i.e. tweets), so you can get them straight from there and avoid making another call as well:

 var twitter = FluentTwitter.CreateRequest()
            .Statuses().OnHomeTimeline().AsJson();

 var response = twitter.Request();
 var tweets = response.AsTweets();
 foreach ( var tweet in tweets )
 {
     Console.Writeline( "Posted by {0}, who has {1} followers", tweet.User.ScreenName, tweet.User.FollowersCount);
 }
Jason Diller