Search in sources :

Example 1 with Tweet

use of twitter4j.Tweet in project aries by apache.

the class TwitterQuery method start.

/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
public void start(BundleContext context) throws Exception {
    Twitter twitter = new Twitter();
    Query query = new Query("from:theasf");
    try {
        QueryResult result = twitter.search(query);
        List<Tweet> tweets = result.getTweets();
        System.out.println("hits:" + tweets.size());
        for (Tweet tweet : tweets) {
            System.out.println(tweet.getFromUser() + ":" + StringEscapeUtils.unescapeXml(tweet.getText()));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : QueryResult(twitter4j.QueryResult) Query(twitter4j.Query) Tweet(twitter4j.Tweet) Twitter(twitter4j.Twitter)

Aggregations

Query (twitter4j.Query)1 QueryResult (twitter4j.QueryResult)1 Tweet (twitter4j.Tweet)1 Twitter (twitter4j.Twitter)1