How can I capture hashtags on Twitter using Java?
-
28-12-2020 - |
Вопрос
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.
Решение
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/
Другие советы
I'm willing to bet that Twitter does not expose a 'push' model for search results. I've seen several pieces of client software that make it look like you're getting real-time search results, but they're really just polling at allowed rates through the search API.