【问题标题】:How can I get tweets older than a week?如何获得超过一周的推文?
【发布时间】:2018-05-23 08:46:37
【问题描述】:

我正在尝试收集有关自然灾害的推文,只是为了我的学术目的。但似乎我无法获得超过一周的推文。

我尝试过 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}

【问题讨论】:

  • 显示你当前的代码
  • @MarcinOrlowski 更新了我的问题

标签: python twitter tweepy twython python-twitter


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-27
    • 2014-08-04
    • 2015-06-14
    • 2014-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多