【问题标题】:Twitter4j API: setMaxId() not working properlyTwitter4j API:setMaxId() 无法正常工作
【发布时间】:2015-03-20 18:15:56
【问题描述】:

我正在使用 twitter4j 使用 max_id 下载旧推文,如下所示:

TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
String emotion = "#sad OR #happy OR #angry OR #anxious OR #fear OR #surprised";	
Query query = new Query(emotion);
query.setMaxId(576017086843088896L);	// start downloading tweets older than this tweet
query.setCount(100);
QueryResult queryResult = twitter.search(query); // returns zero tweets

我已尝试根据之前下载的有效状态 ID 设置各种 MaxId。但它返回的推文为零。 如果我不设置 MaxId,它可以正常工作并返回最近的推文。 知道出了什么问题吗?

更新:我也尝试过使用以下配置(删除了 maxId 配置)。这也导致推文数量为零。

query.since("2015-01-01");
query.until("2015-03-11");

【问题讨论】:

  • 您找到解决方案了吗?或者至少找出问题所在?

标签: java twitter twitter4j


【解决方案1】:

twitter.search(query)

这将仅获取过去 7 天的推文。

在此之前您无法搜索。您可能需要查看私有 API,例如 https://gnip.com/sources/twitter/historical/

【讨论】:

    猜你喜欢
    • 2016-12-01
    • 1970-01-01
    • 2016-09-01
    • 2012-07-11
    • 2018-04-08
    • 2017-04-20
    • 2018-10-02
    • 2016-09-04
    • 2010-10-06
    相关资源
    最近更新 更多