Results 1 to 8 of 8

Thread: Twitter friendOperations().getFollowers(String screenName) returns only 100 followers

  1. #1
    Join Date
    Oct 2010
    Posts
    22

    Default Twitter friendOperations().getFollowers(String screenName) returns only 100 followers

    Twitter friendOperations().getFollowers(String screenName) returns only 100 followers list, how can i retrieve all the followers or only 200 followers??

  2. #2
    Join Date
    Aug 2004
    Posts
    1,099

    Default

    Good catch. The "statuses/followers" resource consumed within getFollowers() only returns 100 users worth of info. Even then, Twitter recently deprecated that resource and suggests to use "followers/ids" followed by "users/lookup" instead.

    I've created https://jira.springsource.org/browse/SOCIAL-210 to track this. In the meantime, you can accomplish the same thing by calling getFollowerIds(), then breaking the results down into 100-entry (or less) sublists and calling UserOperations.getUsers() for each sublist.
    Craig Walls
    Spring Social Project Lead

  3. #3
    Join Date
    Aug 2004
    Posts
    1,099

    Default

    I've just pushed a nightly build of the Twitter module that removes the use of those deprecated resources and uses the Twitter-recommended approach (1 call to get the IDs + 1 call for every 100 IDs). Give it a try and let me know if that works for you.

    FWIW, although this approach will give you all of your followers and is the Twitter-recommended way, be mindful that getFollowers() and getFriends() result in multiple calls to Twitter for resources that are rate-limited. If all you need are the IDs, consider calling getFriendIds() or getFollowerIds() instead. Or if you just need *some* of the friends/followers, collect those IDs and call UserOperations.getUsers().
    Craig Walls
    Spring Social Project Lead

  4. #4
    Join Date
    Oct 2010
    Posts
    22

    Default

    Thank you for replying, i will try this .

  5. #5
    Join Date
    Oct 2010
    Posts
    22

    Default

    I tried getFollowerIds("ScreenName") for one of the user who has more than 20,000 followers but it returns me only 5000 records, i took the latest spring-social-showcase example . Is there anything else that am missing ??

  6. #6
    Join Date
    Aug 2004
    Posts
    1,099

    Default

    Wow...20,000 followers! I can honestly say I didn't test for that scenario. But yes, the followers/ids and friends/ids resources return up to 5000 records. But I think it's possible to get more than 5000 (but it will require additional calls to the REST API).

    I've created https://jira.springsource.org/browse/SOCIALTW-4 to look into this.
    Craig Walls
    Spring Social Project Lead

  7. #7
    Join Date
    Jan 2008
    Posts
    253

    Default

    I suggest we test this on Charlie Sheen ;-)

  8. #8
    Join Date
    Aug 2004
    Posts
    1,099

    Default

    That's an epic suggestion. Winning. :-)
    Craig Walls
    Spring Social Project Lead

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •