Does twitter4j provide the capability to search tweets between 2 dates

有些话、适合烂在心里 提交于 2019-12-21 05:40:53

问题


Does twitter4j provide the capability to search tweets between 2 dates (e.g. 2011-10-27 05:30:00 to 2011-10-27 06:30:00)

currently it seems to have the granularity of a date and not hours or minutes.


回答1:


No, at the current version there is no way to specify date & time for searching within given range.

And that's the limitation of Twitter search API:

Notes about Search Operators

since and until

  • do not support the negation (-) operator.
  • List item should be entered in the format year-month-day or yyyy-mm-dd.
  • are assumed to be from/to 00:00 UTC.
  • cannot be set into the future. If until is in the future you will receive an HTTP 403 error with the message: {"error":"You cannot use an 'until:' date in the future"}. If since is in the future you will receive an HTTP 403 error with the message: {"error":"since_id too recent, poll less frequently"}



回答2:


Query query=new Query("#sachin");

//Returns tweets with since the given date.  Date should be formatted as YYYY-MM-DD 

query.setSince("2012-02-20");



回答3:


query.since() works only going back a couple of days, a week or so, not more. I think the only option is to use a screen scraper.



来源:https://stackoverflow.com/questions/7915634/does-twitter4j-provide-the-capability-to-search-tweets-between-2-dates

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!