Hi All,
I am using simple streaming to search for a tweet, And I am using OAUTH auth for the same, as below , All is well untill I run once instance of this code, If I copy the same code in another class and run with same oauth, I get below error , CAN I USE SAME OAUTH AUTH FOR MULTIPLE CLASSES AND RUN IN PARALLEL. Any help will be appreciated
<<Error - Msg >>
420:Returned by the Search and Trends API when you are being rate limited (https://dev.twitter.com/docs/rate-limiting).
Returned by the Streaming API:
Too many login attempts in a short period of time.
Running too many copies of the same application authenticating with the same account name.
twitterStream = new TwitterStreamFactory().getInstance();
twitterStream.setOAuthConsumer("abc", "abcd");
AccessToken accessToken = new AccessToken("xyz, "zyx");
twitterStream.setOAuthAccessToken(accessToken);
twitterStream.addListener(listener);
StatusListener listener = new StatusListener() {
public void onStatus(Status status) {
if (status.getUser().getLang() != null
&& status.getUser().getLang().equalsIgnoreCase("en"))
try {
if(status.getText()!= null){
System.out.println(status.getText());
}
} catch (Exception e) {
e.printStackTrace();
}
}