Created
November 14, 2012 14:06
-
-
Save komiya-atsushi/4072279 to your computer and use it in GitHub Desktop.
#twitter4j QueryResult#nextQuery() always returns null
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Reproducing code of TFJ-705 ( http://jira.twitter4j.org/browse/TFJ-705 ) | |
*/ | |
import twitter4j.Query; | |
import twitter4j.QueryResult; | |
import twitter4j.Twitter; | |
import twitter4j.TwitterException; | |
import twitter4j.TwitterFactory; | |
public class QueryResultNextQueryDemo { | |
public static void main(String[] args) { | |
Twitter twitter = TwitterFactory.getSingleton(); | |
Query q = | |
new Query().query("twitter").count(100).resultType(Query.RECENT); | |
try { | |
while (q != null) { | |
QueryResult res = twitter.search(q); | |
System.out.printf("%d tweets.\n", res.getTweets().size()); | |
q = res.nextQuery(); | |
} | |
} catch (TwitterException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment