Is it possible to get more than 100 tweets using the Twitter4j API?
If so can anyone point out the way to do so??
The number of tweets to return per page, up to a maximum of 100. Defaults to 15. This was formerly the "rpp" parameter in the old Search API. Thanks for contributing an answer to Stack Overflow!
So what you do is run your first 100, then look for the lowest ID and run another query, this time setting that ID (less 1) as your maximum ID. This will return the next 100, which you append to the previous results. You can then run this loop as many times as you need subject to Twitter rate limits.
If you want to get the most recent tweets, you should use t.setMaxId () or t.setSinceId () set to lower or higher than your current lowest/highest ID respectively. Show activity on this post. The number of tweets to return per page, up to a maximum of 100.
The number of tweets to return per page, up to a maximum of 100. Defaults to 15. This was formerly the "rpp" parameter in the old Search API. Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question. Provide details and share your research! But avoid … Asking for help, clarification, or responding to other answers.
Would need to see your code to provide a code example specific to your case, but you can do this through since_id
or max_id
.
This information is for the Twitter API.
max_id
option set to the id you just found.since_id
option set to the id you just found.In Twitter4j, your Query
object has two fields that represent the above API options: sinceId
and maxId
.
You can't load more than 100 tweet per request but i don't know why you want this, instead you can load all tweets in "Endless page" i.e loading 10 items each time the user scroll a list .
for example
Query query = new Query("stackoverflow");
query.setCount(10);// sets the number of tweets to return per page, up to a max of 100
QueryResult result = twitter.search(query);
now if you want to load the next page simple easy
if(result.hasNext())//there is more pages to load
{
query = result.nextQuery();
result = twitter.search(query);
}
and so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With