wpftwittertweetsharp

How to get all friends - TweetSharp


I'm using the ListFriends() method of TweetSharp library to get all friends of my user (My user has 500 friends).

   TwitterCursorList<TwitterUser>  friendsList = service.ListFriends(new ListFriendsOptions { Cursor=-1,SkipStatus=true});
 while (friendsList.NextCursor != null)
 {
   foreach (var item in friendsList)
   {
     count++;
   }
    TwitterCursorList<TwitterUser>  friendsList = service.ListFriends(new ListFriendsOptions { Cursor = friendsList.NextCursor, SkipStatus = true });
 }

The above code is working well but it gives me only 300 friends because ListFriends() method has rate limit of 15 per 15 mins and when I'm trying to get more friends its rate limits get over.

How to get all friends in one attempt coz my requirement is to show all friends.


Solution

  • friends/ids will give you the id's of your friends (5.000 max/request). After that you can do a users/show to get the details for the userid's. I don't know what TweetSharp methods you need to use, but I think you can find that in the documentation.