如何获取一周前的推文?

2024-10-03 09:17:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图收集有关自然灾害的微博,只是为了我的学术目的。但似乎我不能得到超过一周的微博。在

我试过tweepy,python twitter,twython。在

有没有什么可以让我收集更多的微博?在

我的代码

from twython import Twython
import json
app_key=""
app_secret=""
oauth_token=""
ouath_token_secret=""

twitter = Twython(app_key,app_secret,oauth_token,ouath_token_secret)

data=twitter.search(q='MumbaiRains',result_type='Mixed',count=100)

statuses = data['statuses']

for post in statuses:
    print(post['id_str']+':'+post['text'])

我能得到80条记录,因为在过去的7天里只有80条微博。在

如果我打印数据['search_metadata'],我将得到

{u'count': 100, u'completed_in': 0.053, u'max_id_str': u'939389383920164864', u'since_id_str': u'0', u'refresh_url': u'?since_id=939389383920164864&q=MumbaiRains&result_type=Mixed&include_entities=1', u'since_id': 0, u'query': u'MumbaiRains', u'max_id': 939389383920164864}


Tags: keyimporttokenidappsecrettwitterpost
1条回答
网友
1楼 · 发布于 2024-10-03 09:17:10

Twitter的standard Search API只提供对过去7天的tweet的访问。有付费和企业付费选项可以访问30天的tweet,除此之外还有一个企业完整存档搜索选项。使用标准的免费访问,您将被限制在7天的数据。在

相关问题 更多 >