1
votes

Is there a limit on the number of followers that I can get for a 'user' ( who is not me ) from the Twitter API? I have written a python script to hit this URL: https://api.twitter.com/1/followers/ids.json?screen_name=userid

and it returns me a maximum of 5000, for even twitter users who have more than 2,000,000 followers. I 'm trying to build a recommendation system, so I'd require all the followers of a particular user.

2
Hi does the answer below solve your problem? Any clarification needed?Steve Casey

2 Answers

2
votes

there is only a limit on the number of followers you can retrieve per-page to 5000, as you have discovered.

to retrieve the next 5000 followers and so-on, you need to use the next-cursor=X parameter in your requests. the next-cursor value should be present in your first response.

response example:

{
  "previous_cursor": 0,
  "ids": [
    143206502,
    143201767,
    777925
  ],
  "previous_cursor_str": "0",
  "next_cursor": 0,
  "next_cursor_str": "0"
}

example taken from https://dev.twitter.com/docs/api/1/get/followers/ids

1
votes

There is no limit on the number of follower you can retrieve.

But the number of request you can send to the API has limit.

You can see it on headers of the response: Example before make 5 calls:

x-rate-limit-limit: 900 x-rate-limit-remaining: 895

Here you can check the limits for each token type (user or app) and the request:
https://dev.twitter.com/rest/public/rate-limits

Here you have information about API Rate Limits:
https://dev.twitter.com/rest/public/rate-limiting