I am trying to search a tweets using search method in twitter4j with
effects similar to this website:Monitter.com
Like this website, I want to display a tweets in real time twitter
updates. I just want the tweets to be loaded in a similar manner.
So how do i search tweets in similar to this website(Monitter.com)?
Please could someone show me a simple query examples.
I’m assuming that you already know how to use the twitter4j examples. If you look at the
SearchTweets.javafile under “twitter4j-2.2.5\twitter4j-examples\src\main\java\twitter4j\examples\search”, the following code will be relevant to you:For real-time updating like Monitter, you should encase this chunk in a loop that runs at regular intervals (check out
Thread.sleep()). Next, you may want to shorten the number of results retrieved based on your frequency. For that, open upQuery.javaunder “twitter4j-2.2.5\twitter4j-examples\src\main\java\twitter4j”. The default Query forSearchTweets.javauses only a String argument, but you’ll want to look at thesetRpp()andsetSince()methods.I’m still new to this too so I can’t be certain about it, but I hope my answer helps! I’d have commented instead but I don’t have sufficient privileges.