简体   繁体   中英

Does twitter4j provide the capability to search tweets between 2 dates

Does twitter4j provide the capability to search tweets between 2 dates (eg 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.

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"}
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");

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM