Is it possible to get more than 100 tweets?

后端 未结 7 1633
甜味超标
甜味超标 2020-12-09 10:20

Is it possible to get more than 100 tweets using the Twitter4j API?
If so can anyone point out the way to do so??

7条回答
  •  悲&欢浪女
    2020-12-09 10:59

    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.

提交回复
热议问题