.NET 4.0 WinForms 앱에서 TweetSharp v2.3.0을 사용하고 있습니다. 다음은 나를위한 것입니다.
// this code assumes that your TwitterService is already properly authenticated
TwitterUser tuSelf = service.GetUserProfile(
new GetUserProfileOptions() { IncludeEntities = false, SkipStatus = false });
ListFollowersOptions options = new ListFollowersOptions();
options.UserId = tuSelf.Id;
options.ScreenName = tuSelf.ScreenName;
options.IncludeUserEntities = true;
options.SkipStatus = false;
options.Cursor = -1;
List<TwitterUser> lstFollowers = new List<TwitterUser>();
TwitterCursorList<TwitterUser> followers = service.ListFollowers(options);
// if the API call did not succeed
if (followers == null)
{
// handle the error
// see service.Response and/or service.Response.Error for details
}
else
{
while (followers.NextCursor != null)
{
//options.Cursor = followers.NextCursor;
//followers = m_twService.ListFollowers(options);
// if the API call did not succeed
if (followers == null)
{
// handle the error
// see service.Response and/or service.Response.Error for details
}
else
{
foreach (TwitterUser user in followers)
{
// do something with the user (I'm adding them to a List)
lstFollowers.Add(user);
}
}
// if there are more followers
if (followers.NextCursor != null &&
followers.NextCursor != 0)
{
// then advance the cursor and load the next page of results
options.Cursor = followers.NextCursor;
followers = service.ListFollowers(options);
}
// otherwise, we're done!
else
break;
}
}
참고 :이 질문은 중복되는 것으로 간주 될 수 있습니다. (here 및 here을 참조하십시오.) 그러나 기존 질문은 버전 2.3.0에 TwitterService.ListFollowersOf()
메서드가 없기 때문에 다른 TweetSharp 버전과 관련이있는 것으로 보입니다.
감사합니다. 예상대로 작동합니다. v1.1 트위터 만 사용하면 15 요청/15 분만 허용됩니다. https://dev.twitter.com/docs/rate-limiting/1.1/ 여기를 참조하십시오. 당신이 얻을 수있는 fowllowers의 최대 수는 15 분에 300입니다 :) – hriziya
@HiteshRiziya [follow followers/ids] (https://dev.twitter.com/docs/api/1.1/get/followers/ids)를 사용할 수 있습니다.)와 [GET users/lookup] (https://dev.twitter.com/docs/api/1.1/get/users/lookup)을 사용하여 15 분 안에 최대 18000 명의 팔로어를 확보 할 수 있습니다. –