Skip to main content
 首页 » 编程设计

python之使用 Python 的旧推文 Tweepy

2025年05月04日17softidea

我正在尝试使用 Python 中的 tweepy 获取较旧的推文数据(大约 2 个月前)。我尝试了 since 和 until 参数但没有成功。有没有人在 tweepy 或其他一些 API 中得到解决。

for id,tweet in enumerate (tweepy.Cursor(api.search, q='SpecificWord', since="2016-04-26", until="2016-04-28", lang="en", include_retweets=False    ).items(200)): 
     #Write a row to the csv file 
     CSVW.writerow([tweet.created_at,    tweet.retweet_count,    tweet.text.encode('utf-8')]) 

请您参考如下方法:

这是不可能的。 The docs on the Twitter API are very clear :

The Twitter Search API searches against a sampling of recent Tweets published in the past 7 days.

没有比这更远的搜索方式了。