View Full Version : Twitter friendOperations().getFollowers(String screenName) returns only 100 followers
GSP
Jun 29th, 2011, 01:18 PM
Twitter friendOperations().getFollowers(String screenName) returns only 100 followers list, how can i retrieve all the followers or only 200 followers??
habuma
Jun 29th, 2011, 02:49 PM
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.
habuma
Jun 29th, 2011, 05:35 PM
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().
GSP
Jul 15th, 2011, 04:42 PM
Thank you for replying, i will try this .
GSP
Jul 16th, 2011, 12:01 AM
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 ??
habuma
Jul 18th, 2011, 08:18 AM
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.
mschipperheyn
Jul 18th, 2011, 11:42 AM
I suggest we test this on Charlie Sheen ;-)
habuma
Jul 18th, 2011, 11:54 AM
That's an epic suggestion. Winning. :-)
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.