Problem with calling Twitter4j getFollowersIDs

I am new to this Twitter4j library. I am trying to save all user followers ids with given userID . I am using something like the following:

 IDs ids; long cursor = -1; do{ ids = twitter.getFollowersIDs(userName, cursor); for (long id : ids.getIDs()) { // Store this id... } while ((cursor = ids.getNextCursor()) != 0); 

After a while I get the error message Rate limit exceeded , this is normal. However, I don’t know how to continue to keep the repeater identifiers of the given user ID when the speed limit problem is fixed in the future?

PS: userID , from whom I am trying to keep the repeater ID, there are more than 3 million followers. This is why I need to continue from where I left.

+4
source share
1 answer

The API resource GET followers/ids - that getFollowersIDs() is under the hood - depends on the speed limit.

According to the speed limit documentation for this resource, you can execute 15 queries in the speed limit window with windows that are 15 minutes in duration. Thus, in fact, every 15 minutes you can make 15 more requests.

It seems that in order for you to get 3m follower identifiers, you need to somehow turn off your queries, for example. only make a request per minute, etc.

Note that the speed limit is for each resource, and some restrictions are more generous than others. You can learn more about how speed limiting works here .

+3
source

Source: https://habr.com/ru/post/1486827/


All Articles