Twitter API - POST favorites/create 特定速率限制

Twitter API - POST favorites/create Specific Rate Limit

我遇到了一个问题,我的脚本因 message undefined 错误而崩溃,已在此处得到解答:

事实证明,当达到速率限制时,错误消息的传递方式不同,因此 console.log('Try Favorite - ', err[0].message); 会 return 一个错误,除非更改为 console.log('Try Favorite - ', err.message);

它现在输出为 [[Apr 28 22:26:01.024]] [LOG] Try Favorite - HTTP Error: 429 Too Many Requests,这表明存在速率限制,但是,我没有找到明确的速率限制。

POST 的所有文档都将状态限制为 1000,但是,我计算在最后 8 小时内总共有 22 个,所以它被速率限制很奇怪。

有谁有更清楚的文档吗?我找到的所有链接似乎都已失效。

我还要补充一点,只有收藏受到影响,所有其他请求都正常。

编辑:添加最近的输出。 Undefined 将是 You already ____ed this tweet,但是,由于为防止应用程序崩溃而进行的临时更改,消息未定义。

[[Apr 28 23:57:00.560]] [LOG]   Try Favorite -  HTTP Error: 429 Too Many Requests
[[Apr 28 23:57:00.562]] [LOG]   Try Favorite -  HTTP Error: 429 Too Many Requests
[[Apr 28 23:57:00.563]] [LOG]   Try Favorite -  HTTP Error: 429 Too Many Requests
[[Apr 28 23:57:00.564]] [LOG]   Try Favorite -  HTTP Error: 429 Too Many Requests
[[Apr 28 23:57:00.575]] [LOG]   Try Favorite -  HTTP Error: 429 Too Many Requests
[[Apr 28 23:57:00.578]] [LOG]   Try Retweet -  undefined
[[Apr 28 23:57:00.583]] [LOG]   Try Favorite -  HTTP Error: 429 Too Many Requests
[[Apr 28 23:57:00.584]] [LOG]   Try Retweet -  undefined
[[Apr 28 23:57:00.589]] [LOG]   Try Favorite -  HTTP Error: 429 Too Many Requests
[[Apr 28 23:57:00.592]] [LOG]   Try Retweet -  undefined
[[Apr 28 23:57:00.593]] [LOG]   Try Retweet -  undefined
[[Apr 28 23:57:00.599]] [LOG]   Try Retweet -  undefined
[[Apr 28 23:57:00.604]] [LOG]   Try Retweet -  undefined
[[Apr 28 23:57:00.609]] [LOG]   Try Retweet -  undefined
[[Apr 28 23:57:00.619]] [LOG]   Retweeted: https://twitter.com/username/status/90374******24768
[[Apr 28 23:57:00.634]] [LOG]   Try Retweet -  undefined
[[Apr 28 23:57:00.671]] [LOG]   Try Retweet -  undefined
[[Apr 28 23:57:00.754]] [LOG]   Try Favorite -  HTTP Error: 429 Too Many Requests
[[Apr 28 23:57:00.800]] [LOG]   Favorited:  https://twitter.com/username/status/99037*******48615

编辑:我被告知我明显超出了速率限制,但是这个问题只是在今天工作 5 天前才出现。转推仍然是 returning You have already retweeted this tweet 而收藏是 returning Status 429.

编辑:尝试对另一个只有 statuses/retweet 请求的测试用户进行测试,一切顺利。尝试使用不同的测试用户(以避免最后一次测试使用)favorites/create 并且它运行第一个间隔,然后在第二次请求后立即将速率限制为每 2 分钟 5 个请求,这意味着我被限制在 7 favorites/create 每 4 分钟请求一次。

这让我相信收藏夹有一个特定的限制,但是,这个确切的间隔在 5 天前工作时仍然不清楚。

根据 twitter documentation,标准帐户的限制是每个速率限制 15 个请求 window,即 15 分钟。因此,如果您在不到 15 分钟内发送了 22 个请求,那么您就超出了限制。

Rate limiting of the standard API is primarily on a per-user basis — or more accurately described, per user access token. If a method allows for 15 requests per rate limit window, then it allows 15 requests per window per access token.

When using application-only authentication, rate limits are determined globally for the entire application. If a method allows for 15 requests per rate limit window, then it allows you to make 15 requests per window — on behalf of your application. This limit is considered completely separately from per-user limits.

如果您想提高限额,请查看 premium APIs

似乎没有任何记录在案的 favorites/create 具体限制,但是,今天似乎一切正常。不完全清楚发生了什么,因为没有更新发布到 Twitter System Status 页面。

The current technical limits of POST requests for accounts are:

  • Direct Messages (daily): The limit is 1,000 messages sent per day. Tweets: 2,400 per day. The daily update limit is further broken down into smaller limits for semi-hourly intervals. Retweets are counted as Tweets. Changes to account email: 4 per hour.
  • Following (daily): The technical follow limit is 1,000 per day. Please note that this is a technical account limit only, and there are additional rules prohibiting aggressive following behavior. Read about following limits and prohibited behavior.
  • Following (account-based): Once an account is following 5,000 other accounts, additional follow attempts are limited by account-specific ratios. These limits include actions from all devices, including web, mobile, phone, API, etc. API requests from all third-party applications are tracked against the hourly API limit. People who use multiple third-party applications with their account will therefore reach the API limit more quickly.

These limits may be temporarily reduced during periods of heavy site usage. In such cases, we will post an update on the Twitter status site.

This being said, it seems likely that limits were reduced at the time but unreported.

另外,请参阅上面 Marco 的回答以获取有关高级 API 的有用信息。

GET Rate Limits 也可以在 here 中找到,并且有更多的扩展,但是文档没有说明单独的 POST 选项比别人都有限