Retrieve Tweets using Twitter4J
|
|
|
The following article describes how to retrieve Tweets using Twitter4J library.Let's imaginge we want to retrieve Tweets from the @TheJavaTutorial Tweeter user. �Let's take a look
Twitter factory return a thread safe instance of the twitter service
Query is a data class representing a search query. It is not thread safe.
The from keyword indicates we want to find tweets from the provided user.
Twitter provided several other search operators .
Query.setRpp method indicates the number of tweets returned per page, up to the max 100.
Query.setSince returns tweets with since the given date
That's all. If you found this article usefull click on the google +1 button below to recommend our website. Thanks in advance
Twitter search operators
| Operator | Finds tweets... |
|---|---|
| twitter search | containing both "twitter" and "search". This is the default operator. |
| "happy hour" | containing the exact phrase "happy hour". |
| love OR hate | containing either "love" or "hate" (or both). |
| beer -root | containing "beer" but not "root". |
| #haiku | containing the hashtag "haiku". |
| from:alexiskold | sent from person "alexiskold". |
| to:techcrunch | sent to person "techcrunch". |
| @mashable | referencing person "mashable". |
| "happy hour" near:"san francisco" | containing the exact phrase "happy hour" and sent near "san francisco". |
| near:NYC within:15mi | sent within 15 miles of "NYC". |
| superhero since:2011-07-14 | containing "superhero" and sent since date "2011-07-14" (year-month-day). |
| ftw until:2011-07-14 | containing "ftw" and sent up to date "2011-07-14". |
| movie -scary :) | containing "movie", but not "scary", and with a positive attitude. |
| flight :( | containing "flight" and with a negative attitude. |
| traffic ? | containing "traffic" and asking a question. |
| hilarious filter:links | containing "hilarious" and linking to URLs. |
| news source:twitterfeed | containing "news" and entered via TwitterFeed |
If you have any remark or questions feel free to put a comment.If you enjoyed this tutorial and want to promote it don't hesitate to click on
Related Article
Tags: search , twitter , tweets , person , hour , 2011-07-14 , happy , query