本文整理汇总了C#中TweetSharp.TwitterService.ListFollowersOf方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterService.ListFollowersOf方法的具体用法?C# TwitterService.ListFollowersOf怎么用?C# TwitterService.ListFollowersOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TweetSharp.TwitterService
的用法示例。
在下文中一共展示了TwitterService.ListFollowersOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFollowersFor
public static TwitterUser[] GetFollowersFor(string sUsername)
{
// Pass your credentials to the service
TwitterService service = new TwitterService("g0fsdKhJObiZLamY2P7vfg", "ghUKQ9y0LvN08clZq6wwU41a0gMlrv9oGj9zd55292w");
// Step 1 - Retrieve an OAuth Request Token
OAuthRequestToken requestToken = service.GetRequestToken();
// Step 2 - Redirect to the OAuth Authorization URL
Uri uri = service.GetAuthorizationUri(requestToken);
//Process.Start(uri.ToString());
// Step 3 - Exchange the Request Token for an Access Token
string verifier = "123456"; // <-- This is input into your application by your user
OAuthAccessToken access = service.GetAccessToken(requestToken, verifier);
access.TokenSecret = "6CFvw63PNUNx4cbj53n5idwlaRUVSz9lKNhr8FM";
access.Token = "14820993-dEh4f6mD1RNSe1pp8ZmKwJb9g0TGyyGqyHuvZsM9s";
// Step 4 - User authenticates using the Access Token
service.AuthenticateWith(access.Token, access.TokenSecret);
TwitterCursorList<TwitterUser> followersList = null;
TwitterCursorList<TwitterUser> list = service.ListFollowersOf(sUsername, -1);
long? nextCursor = list.NextCursor;
followersList = new TwitterCursorList<TwitterUser>(list);
while ((nextCursor ?? 0) != 0)
{
TwitterCursorList<TwitterUser> tempFollowersList = service.ListFollowersOf(sUsername, (long)nextCursor);
if (tempFollowersList.Count <= 0)
break;
followersList.AddRange(tempFollowersList);
nextCursor = tempFollowersList.NextCursor;
}
TwitterUser[] array = new TwitterUser[followersList.Count];
followersList.CopyTo(array);
return array;
}