Search code examples
javaapitwitterhashtaghttp-streaming

How can I capture hashtags on Twitter using Java?


Using the Twitter Java API, how can I listen for all tweets containing an arbitrary hashtag like "#Yosemite" or "#Scubadiving"? I know twitter exposes an Atom API over http, but we don't want to poll for data, we want to be notified in real-time when the hashtags are used in tweets.


Solution

  • Twitter does in fact offer a push APi to listen to hashtags. It's called the Twitter Streaming API. Your currently able to listen to 400 keywords and hashtags in this case.

    Edit: integrate streaming API with Java

    http://awalkingcity.com/blog/2009/06/22/using-java-with-the-twitter-streaming-api/