访问 Reddit 时出现 HTTP 429 请求过多。json 页面仅使用 Java 一次
HTTP 429 Too Many Requests when accessing a Reddit .json page only once using Java
当我尝试使用 Java.
扩展名访问任何 Reddit 页面时,我收到 HTTP 429 太多请求响应
我正在使用找到 here 的 Java 代码,没有任何修改(除了更改目标 URL)。我正在尝试访问 URLs,如下所示:
- http://www.reddit.com/r/news.json
- http://www.reddit.com/r/news/comments/3aqhk7/a_17yearold_invented_an_ingenious_way_to.json
我可以使用浏览器访问这些页面,但无法以编程方式访问它们,尽管我每次都发出一个请求并在两者之间等待。 Reddit returns this message when more than 30 requests are made in a minute,但我的收入远低于此,而且我网络上没有其他人使用 Reddit。
有没有人熟悉这个以及为什么我可能会收到这些错误?使用 Java 是否有更好的方法来解决这个问题?
确保使用自定义用户代理字符串 - 请参阅 API 规则的第 4 个要点:
Change your client's User-Agent string to something unique and descriptive, including the target platform, a unique application identifier, a version string, and your username as contact information, in the following format:
<platform>:<app ID>:<version string> (by /u/<reddit username>)
Example:
User-Agent: android:com.example.myredditapp:v1.2.3 (by /u/kemitche)
Many default User-Agents (like "Python/urllib" or "Java") are drastically limited (emphasis mine) to encourage unique and descriptive user-agent strings.
Including the version number and updating it as your build your application allows us to safely block old buggy/broken versions of your app.
NEVER lie about your user-agent. This includes spoofing popular browsers and spoofing other bots. We will ban liars with extreme prejudice.
当我尝试使用 Java.
扩展名访问任何 Reddit 页面时,我收到 HTTP 429 太多请求响应我正在使用找到 here 的 Java 代码,没有任何修改(除了更改目标 URL)。我正在尝试访问 URLs,如下所示:
- http://www.reddit.com/r/news.json
- http://www.reddit.com/r/news/comments/3aqhk7/a_17yearold_invented_an_ingenious_way_to.json
我可以使用浏览器访问这些页面,但无法以编程方式访问它们,尽管我每次都发出一个请求并在两者之间等待。 Reddit returns this message when more than 30 requests are made in a minute,但我的收入远低于此,而且我网络上没有其他人使用 Reddit。
有没有人熟悉这个以及为什么我可能会收到这些错误?使用 Java 是否有更好的方法来解决这个问题?
确保使用自定义用户代理字符串 - 请参阅 API 规则的第 4 个要点:
Change your client's User-Agent string to something unique and descriptive, including the target platform, a unique application identifier, a version string, and your username as contact information, in the following format:
<platform>:<app ID>:<version string> (by /u/<reddit username>)
Example:
User-Agent: android:com.example.myredditapp:v1.2.3 (by /u/kemitche)
Many default User-Agents (like "Python/urllib" or "Java") are drastically limited (emphasis mine) to encourage unique and descriptive user-agent strings.
Including the version number and updating it as your build your application allows us to safely block old buggy/broken versions of your app.
NEVER lie about your user-agent. This includes spoofing popular browsers and spoofing other bots. We will ban liars with extreme prejudice.