如何使用Twitterizer获取给定用户名的Twitter关注者屏幕名称?

时间:2012-11-24 21:08:33

标签: c# asp.net json twitter twitterizer

OAuthTokens tokens = new OAuthTokens();
tokens.AccessToken = "188817262xxxxx";
tokens.AccessTokenSecret = "GNqhB1gkxxxx";
tokens.ConsumerKey = "Q6xxxxx";
tokens.ConsumerSecret = "2eZyxxxxxx";

var<TwitterUser> showUserResponse = TwitterUser.Show(tokens, "twitterUsername");
if (showUserResponse.Result == RequestResult.Success)
    {
    string screenName = showUserResponse.ResponseObject.ScreenName;
    Response.Write(screenName);
    Response.Write("<br>");
    Response.Write(showUserResponse.ResponseObject.NumberOfFollowers);
    }

使用此代码,我可以获取我的Twitter screenNamenumberOfFollowers,但我想在我的asp.net应用程序上打印这些关注者screenName。我怎样才能做到这一点?

FollowersOptions options = new FollowersOptions();
options.ScreenName = "wallace740";
TwitterResponse<TwitterUserCollection> followers = TwitterFriendship.Followers(options);

// Response.Write(followers.Content);

如何从这个JSON中获取screenName我的粉丝(followers.Content给我一个JSON结果)?

1 个答案:

答案 0 :(得分:1)

您可以通过ReponseObject枚举。

        foreach (var follower in followers.ResponseObject)
        {
            follower.ScreenName;
        }