【发布时间】:2018-09-18 18:03:49
【问题描述】:
我在 Python 中有以下代码:
import tweepy
consumer_key = "..."
consumer_secret = "..."
access_token = "..."
access_token_secret = "..."
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
start_date = datetime.datetime(2018, 1, 19, 12, 00, 00)
end_date = datetime.datetime(2018, 1, 19, 13, 00, 00)
api = tweepy.API(auth)
for tweet in tweepy.Cursor(api.user_timeline, screen_name="@IBM", since=start_date, until=end_date).items():
print("ID TWEET: " + str(tweet.id))
有没有办法通过用 tweepy 修改光标来获取 start_date 和 end_date 之间的推文?
我已经尝试过使用since= 和until= 参数,但它们没有奏效。
提前谢谢你。
【问题讨论】:
-
until有时间限制:(...) the search index has a 7-day limit. In other words, no tweets will be found for a date older than one week.developer.twitter.com/en/docs/tweets/search/api-reference/… -
这可能会有所帮助...
https://stackoverflow.com/questions/26205102/making-very-specific-time-requests-to-the-second-on-twitter-api-using-python或这个https://gist.github.com/alexdeloy/fdb36ad251f70855d5d6