javascript - 通过 API 获取 Instagram 当前的点赞和关注限制

标签 javascript php ajax instagram instagram-api

我拥有一个自动执行 Instagram 操作的网站,目前我每小时获得 100 个点赞,每小时获得 100 个关系帖子(我知道它说是 60 个关系帖子,但我已经获得了 100 个)。我强制执行签名 header ,并且自从添加了我的电子邮件地址后,我没有注意到 400 错误,只是一些建议。

所以我的问题是,如何找到当前关于点赞和关注/取消关注的请求限制?我知道在 header 中,他们提供了您发出的请求数(与一小时内的 5,000 个请求相比),但我想具体知道何时会收到 429“OAuthRateLimitException”错误,这样我就不必点击每小时都有此限制,在数百个用户每小时收到此错误后,我注意到,这对我的应用程序来说看起来不太好。

如果有人能告诉我如何获取一小时内发出的点赞请求数量,以便我可以在收到 429 错误之前停止,那就太好了。我使用 JavaScript、ajax 和 PHP 来调用电话。 谢谢。

最佳答案

您可能不会为每个用户使用 Oauth token 。通过这样做,速率限制将根据使用您的应用程序的人数进行调整。

至于告诉你还剩下多少,它应该在 HTML header 响应中。来自他们的documentation :

HTTP Header

Information regarding the global rate limits is included in the HTTP header on the response to each of your calls, which enables your app to determine its current status with respect to these rate limits. The following fields are provided in the header of each response and their values are related to the type of call that was made (authenticated or unauthenticated):

X-Ratelimit-Remaining: the remaining number of calls available to your app within the 1-hour window

X-Ratelimit-Limit: the total number of calls allowed within the 1-hour window

关于javascript - 通过 API 获取 Instagram 当前的点赞和关注限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30430627/

相关文章:

php - 使用ajax重新加载php代码

c# - 如何在ajax日历扩展器中限制年份

javascript - Aurelia 绑定(bind)失败不抛出错误?

javascript - 在 while 循环中从按钮获取值

php - 重用错误信息的方法

php - 如何将 HTML 表单中的值添加到数据库中的值

javascript - 如何进行 AJAX 调用,以便仅在单击特定类中包含的链接并包含父元素的 "id"时触发?

javascript - 输入 cmd grunt jshint 时出错。

javascript - jQuery .attr ('type' , 'submit' ) 在一个按钮元素上给我一个奇怪的 IE7 错误

javascript - React 无法识别函数