TwitterException {statusCode=403,retryAfter=0,rateLimitStatus=null}
我最近注意到在进行 Twitter 搜索时不断收到 403 错误。我的应用程序一直在工作,直到几天前我注意到这个错误。
我查了一下 Twitter 和他们说我的 IP 没有被阻止,我也在速率限制内 = 大约 60 个搜索请求/每小时。
以下是我初始化 Twitter 对象的方式 -
private static Twitter TWITTER_CLIENT = new TwitterFactory().getInstance();
在我注意到错误后,我尝试了以下操作:仍然没有成功 -
private static Twitter TWITTER_CLIENT = new TwitterFactory().getInstance("user", "password");
这就是我的搜索方式 -
TWITTER_CLIENT.search(new Query("#keyword1 OR #keyword2"));
我尝试了这个 URL (curl http:// search.twitter.com/search.json?q=ipad) 来自我的服务器 &它工作正常。
以下是例外情况。我使用的是 java6 + Twitter4j v2.1.2。非常感谢任何帮助。谢谢。
TwitterException{statusCode=403, retryAfter=0, rateLimitStatus=null}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:301)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:68)
at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:82)
at twitter4j.Twitter.search(Twitter.java:193)
I have recently noticed that I keep getting a 403 error while doing twitter search. My application was working until couple of days back when i noticed the error.
I checked with Twitter & they say my IP is not blocked, I am also within the rate limit = about 60 search requests/per hour.
Here's how i was initializing the Twitter object -
private static Twitter TWITTER_CLIENT = new TwitterFactory().getInstance();
After i noticed the error, i tried the following & still no success -
private static Twitter TWITTER_CLIENT = new TwitterFactory().getInstance("user", "password");
Here's how i am searching -
TWITTER_CLIENT.search(new Query("#keyword1 OR #keyword2"));
I tried this URL (curl http://search.twitter.com/search.json?q=ipad) from my server & it works alright.
Following is the exception. I am on java6 + Twitter4j v2.1.2. Would really appreciate any help. Thanks.
TwitterException{statusCode=403, retryAfter=0, rateLimitStatus=null}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:301)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:68)
at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:82)
at twitter4j.Twitter.search(Twitter.java:193)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最有可能的原因是 Twitter 的基本身份验证关闭(又名 OAuthcalypse):
基本身份验证关闭
您需要切换到使用 OAuth。
Most likely the reason is basic auth shutdown by Twitter (aka OAuthcalypse):
Basic Auth Shutdown
You need to switch to using OAuth.
最近我在执行类似的代码时遇到了同样的错误。
要修复此问题,请访问
然后就完成了!您的程序将开始运行。
Recently i got the same error while executing similar code.
To fix it, please go to
And you are done! Your program will start working.