views:

997

answers:

3

Hi, Using the twitter API (and OAuth) if i was to call for the user followers, (statuses/followers) i would be returned only 99 results.

Is there a way i can return 99, then call again starting at follower 100 then looping through this style of calling until the total number of followers has been returned?

Or just return ALL followers?

+4  A: 

You need to specify cursor parameter as described in the API documrnation. E.g. specify cursor=-1 to request the first page and then use a next_cursor value returned in the first response:

  http://twitter.com/statuses/followers/barackobama.xml?cursor=-1
  http://twitter.com/statuses/followers/barackobama.xml?cursor=1300794057949944903
Eugene Kuleshov
+1  A: 

Be sure you're using the right call. followers/ids gives you 5000 at a time (but it's just a list of ids). This call, too, uses the cursor to let you step through pages of users. You get a zero back when you have them all.

Nosredna
A: 

Twitter only allows a certain number of API requests per hour, and I think minute. You might not be able to retrieve any more than 99 requests at once.

alexy13
The total is 150 per hour. So he could get 100 people 150 times (or 5000 people 150 times, depending on the call he uses). This number is for the calls that don't need authorization. Calls that require authorization are tallied separately. You can request whitelisting for your app, but even that is not enough to go banging at the API willy-nilly, so if you expect a high-volume service, you need to do some caching.
Nosredna
But you make a good point. There are many accounts with many more than 15,000 followers. You'll use up all your API hits at once with them.
Nosredna
they are on a per OAuth user basis - if user_1 hits their limit.. they get errors, but user_2 will still be fine
tarnfeld