本文整理匯總了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;
}