Question

I'm using the twitter api in java to query tweets containing certain hashtags.

Example:

Query query = new Query("%23superbowl since:2013-12-21");
QueryResult result;
result = twitter.search(query);
List<Status> tweets = result.getTweets();

Array size is only 15. How do I change the max number of tweets returned?

Was it helpful?

Solution

You can set count in your query as:

query.setCount(100);

But remember, as per Twitter4j doc it allows max up to 100 only. You can check it here

OTHER TIPS

query.setCount() is the key:

The default count is -1 in the library, hence it won't put the parameter in the request.

With no parameter present Twitter defaults to 15, see count paremeter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top