Hi,
I have two questions. First of all, i’m building an app which should keep on searching tweets based on a specific keyword , filter, do some processing and persists in database. The app will be displaying some statistical analysis details based on the data retreived and processed. The webpage will be refreshing in timely manner to show new data received and processed. To address this kind of scenario, which API should i consider as the best option?
Also, i’m using twitter4j as client. The following code throws:
401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, acc
ess token/secret, and the system clock is in sync.
The screen name / password combination seems to be invalid.
What can be the problem? I have verified the keys and they seems to be fine.
try {
Twitter twitter = TwitterFactory.getSingleton();
twitter.setOAuthConsumer("xxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxx");
RequestToken twitterRequestToken = twitter.getOAuthRequestToken();
String token = twitterRequestToken.getToken();
String tokenSecret = twitterRequestToken.getTokenSecret();
AccessToken accessToken = twitter.getOAuthAccessToken(token, tokenSecret);
twitter.setOAuthAccessToken(accessToken);
Query query = new Query("source:twitter4j yusukey");
QueryResult result = twitter.search(query);
for (Status status : result.getTweets()) {
log.info("@" + status.getUser().getScreenName() + ":" + status.getText());
}
} catch (Exception e) {
e.printStackTrace();
}
Thanks.