uk.ac.cam.juliet.twitter.main
Class TwitterSearchAPI

java.lang.Object
  extended by uk.ac.cam.juliet.twitter.main.TwitterSearchAPI

public class TwitterSearchAPI
extends java.lang.Object

An instsance of this class represents an interface to the Twitter search API
it uses the JTwitter open source library to talk to the Twitter search API

Author:
Ahmad Akra

Field Summary
private  winterwell.jtwitter.Twitter twitter
          the twitter object used to interface with the twitter search API
 
Constructor Summary
TwitterSearchAPI()
           
 
Method Summary
private  java.util.List<winterwell.jtwitter.Twitter.Status> getTweets(java.lang.String searchString, winterwell.jtwitter.Twitter twitter)
          tries to call the Twitter search API for tweets containing searchString as the search string, the method fails after n tries printing appropriate error messages to the user
 java.util.List<Tweet> search(java.lang.String searchString, int daysAgo, int tweetsLimit)
          calls the twitter search API on the searchString, it gets all tweets that are created less than daysAgo ago, it lets the newTweetsHandler handle all tweets returned from the search
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

twitter

private winterwell.jtwitter.Twitter twitter
the twitter object used to interface with the twitter search API

Constructor Detail

TwitterSearchAPI

public TwitterSearchAPI()
Method Detail

search

public java.util.List<Tweet> search(java.lang.String searchString,
                                    int daysAgo,
                                    int tweetsLimit)
calls the twitter search API on the searchString, it gets all tweets that are created less than daysAgo ago, it lets the newTweetsHandler handle all tweets returned from the search

Parameters:
searchString - the string to search for on twitter
daysAgo - limit the search results to tweets less then minutesAgo old
tweetsLimit - the maximum number of tweets to fetch

getTweets

private java.util.List<winterwell.jtwitter.Twitter.Status> getTweets(java.lang.String searchString,
                                                                     winterwell.jtwitter.Twitter twitter)
tries to call the Twitter search API for tweets containing searchString as the search string, the method fails after n tries printing appropriate error messages to the user

Parameters:
searchString - the search string to search for
twitter - the interface to the twitter search API
Returns:
the returned list of statuses