Recently, I noticed that when I searched on twitter, I get a 403 error. My application worked up to two days ago when I noticed an error.
I checked with Twitter and they say that my IP address is not blocked, I am also within the speed limit = about 60 searches / hour.
This is how I initialized the Twitter object -
private static Twitter TWITTER_CLIENT = new TwitterFactory().getInstance();
After I noticed the error, I tried the following and still have not succeeded -
private static Twitter TWITTER_CLIENT = new TwitterFactory().getInstance("user", "password");
This is how I am looking -
TWITTER_CLIENT.search(new Query("#keyword1 OR #keyword2"));
I tried this URL (curl http://search.twitter.com/search.json?q=ipad ) from my server and it works well.
The following is an exception. I am on java6 + Twitter4j v2.1.2. It would be very helpful to 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)
source share