2

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.

Sumit Kesarwani
  • 563
  • 2
  • 4
  • 22

2 Answers2

0

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.

JackPoint
  • 4,031
  • 1
  • 30
  • 42
  • friends/ids will give me id's of all friends but i have to use GetUserProfileFor() method to get their profiles which has rate limit of 180, then i get only 180 friends and i have to wait for 15 mins to get more. Is there any other option to get all friends? – Sumit Kesarwani Sep 09 '13 at 12:36
  • Yes, you can use users/lookup to get max 100 profiles in one call. Is that ListUserProfilesFor in TweetSharp? – JackPoint Sep 09 '13 at 13:24
  • Thanks for your valuable suggestion. – Sumit Kesarwani Sep 20 '13 at 11:05
-1

You have one mistake in your code. You cant define friendsList again inside your loop. Thus the last line of code should looks like:

    friendsList = service.ListFriends(new ListFriendsOptions { Cursor = friendsList.NextCursor, SkipStatus = true });
Zuhair
  • 837
  • 1
  • 8
  • 12