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 screenName
和numberOfFollowers
,但我想在我的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结果)?
答案 0 :(得分:1)
您可以通过ReponseObject枚举。
foreach (var follower in followers.ResponseObject)
{
follower.ScreenName;
}