I am trying to perform a "near"search query to fetch tweets nears to certain location using
twitter4j but getting the exception.
public static void main(String[] args) {
Twitter twitter = new TwitterFactory().getInstance();
try {
String searchTerm = "jobs near:\"san francisco\"";
QueryResult result = twitter.search(new Query(searchTerm));
List<Tweet> tweets = result.getTweets();
for (Tweet tweet : tweets) {
System.out.println("@" + tweet.getFromUser() + " - " + tweet.getText());
}
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to search tweets: " + te.getMessage());
}
}
Exception that I am getting
403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following). {"error":"Invalid parameter"} Relevant discussions can be on the Internet at: http://www.google.co.jp/search?q=d35baff5 or http://www.google.co.jp/search?q=08c3b248 TwitterException{exceptionCode=[d35baff5-08c3b248], statusCode=403, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.5}Failed to search tweets: 403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following). {"error":"Invalid parameter"}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:185)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:85)
at twitter4j.TwitterImpl.get(TwitterImpl.java:1895)
at twitter4j.TwitterImpl.search(TwitterImpl.java:98)
at com.xebia.lightning.scheduler.JobTweetsArchiver.main(JobTweetsArchiver.java:115)