我希望在日期之间获得有关某个主题的推文。这可能在tweepy吗? (或用于Twitter的其他API?)
我可以通过使用ID将其用于user_timeline,但是当我将其更改为使用api.search时,该程序基本上只会继续运行而没有任何输出
def getTweets(username):
tweets = []
tmpTweets = api.user_timeline(username, tweet_mode = 'extended', include_rts=True)
for tweet in tmpTweets:
if tweet.created_at < endDate and tweet.created_at > startDate:
tweets.append(tweet)
while (tmpTweets[-1].created_at > startDate):
tmpTweets = api.user_timeline(username, max_id = tmpTweets[-1].id,tweet_mode = 'extended')
for tweet in tmpTweets:
if tweet.created_at < endDate and tweet.created_at > startDate:
tweets.append(tweet)
return tweets
tl; dr: python中是否有一种方法可以基于关键字搜索在两个日期之间获取推文?