简体   繁体   English

API Twitter速率限制

[英]API twitter rate limit

Here is what i'm trying to do : 这是我想做的事情:

I have a list a twitter user ID, for each one of them I need to retrieve a complete list of his followers ID and his friends ID. 我有一个Twitter用户ID列表,对于每个用户,我需要检索他的关注者ID和他的朋友ID的完整列表。 I don't need anything else, no screen name etc.. 我不需要任何其他东西,也不需要屏幕名称等。

i'm using twitter4j btw 我正在使用twitter4j btw

Here is how I'm doing it : 这是我的做法:

for each user i'm executing the following code in order to get a complete list of his followers IDs 对于每个用户,我正在执行以下代码,以获取其关注者ID的完整列表

long lCursor = -1
do{
    IDs response = t.getFollowersIDs(id, lCursor);
    long tab[] = response.getIDs();
    for(long val : tab){
        myIdList.add(val);
    }
    lCursor = response.getNextCursor(); 
}while(lCursor != 0);

My problem : 我的问题 :

according to this page : https://dev.twitter.com/docs/api/1.1/get/followers/ids 根据此页面: https : //dev.twitter.com/docs/api/1.1/get/followers/ids

the request rate limit for getFollowersIDs() is 15, considering this method return a maximum number of 5000 IDs, it means that it will be only possible to get 15*5000 IDs (or 15 users if they have less than 5000 followers). getFollowersIDs()的请求速率限制为15,考虑到此方法最多返回5000个ID,这意味着只能获得15 * 5000个ID(如果关注者少于5000个,则为15个用户)。

This is really not enough for what i'm trying to do. 对于我要执行的操作,这确实是不够的。

Am I doing something wrong ? 难道我做错了什么 ? Is there any solutions to improve that ? 有什么解决方案可以改善吗? (even slightly) (甚至略)

Thanks for your help :) 谢谢你的帮助 :)

The rate limit for that endpoint in v1.1 is 15 calls per 15 minutes per access token . v1.1中该端点的速率限制是每个访问令牌每15分钟15个呼叫。 See https://dev.twitter.com/docs/rate-limiting/1.1 for more information about the limits. 有关限制的更多信息,请参见https://dev.twitter.com/docs/rate-limiting/1.1

With that in mind, if you have an access token for each of your users, you should be able to fetch up to 75,000 (15*5000) follower IDs every 15 minutes for each access token. 考虑到这一点,如果您为每个用户都有一个访问令牌,则您应该能够每15分钟为每个访问令牌获取多达75,000个(15 * 5000)跟随者ID。

If you only have one access token you'll, unfortunately, be limited in the manner you described and will just have to handle when your application hits the rate limit and continue processing once the 15 minutes is up. 不幸的是,如果只有一个访问令牌,则将按照您所描述的方式进行限制,并且仅在应用程序达到速率限制时处理,并在15分钟后继续处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM