Skip to content

Instantly share code, notes, and snippets.

@anarcher
Created August 28, 2010 17:42
Show Gist options
  • Save anarcher/555379 to your computer and use it in GitHub Desktop.
Save anarcher/555379 to your computer and use it in GitHub Desktop.
import twitter4j._
val listener = new StatusListener {
override def onStatus(status:Status) {
println(status.getText)
}
override def onDeletionNotice(notice : StatusDeletionNotice) {}
override def onTrackLimitationNotice(numOfLimitStatues : Int) {}
override def onException(ex : Exception) { ex.printStackTrace }
}
val stream : TwitterStream = new TwitterStreamFactory(listener).getInstance("username","password")
val q : FilterQuery = new FilterQuery(0,null,Array("#scalaqna"));
stream.filter(q);
/*
TwitterException{exceptionCode=[9fcab91e-0006d074 9fcab91e-0006d019], statusCode=-1, retryAfter=0, rateLimitStatus=null, version=2.1.3}
at twitter4j.StatusStreamImpl.handleNextElement(StatusStreamImpl.java:180)
at twitter4j.StatusStreamImpl.next(StatusStreamImpl.java:78)
at twitter4j.TwitterStream$StreamHandlingThread.run(TwitterStream.java:462)
Caused by: java.io.IOException: the end of the stream has been reached
at twitter4j.StatusStreamImpl.handleNextElement(StatusStreamImpl.java:89)
... 2 more
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment