當前位置: 首頁>>代碼示例>>C#>>正文


C# TwitterService.ListFollowersOf方法代碼示例

本文整理匯總了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;
        }
開發者ID:alpascual,項目名稱:Unfollower,代碼行數:41,代碼來源:TwitterUtils.cs


注:本文中的TweetSharp.TwitterService.ListFollowersOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。