问题
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