Tweepy每周趋势图错误34

2024-03-29 09:45:04 发布

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

我正在使用TweepyforPython2.7开发一个项目。实际上,我想在Twitter上收集一些趋势,比如从2014-05-01到2014-06-01。在

为此,我想使用Twitter API提供的trend_weekly。不幸的是,此函数已被弃用(仅限于API 1),并且不存在任何更新版本。然后我试了一下:

api = tweepy.API(auth)

trends_weekly = bind_api(
        search_api = True,
        path = '/1/trends/weekly.json',
        payload_type = 'json',
        allowed_param = ['date', 'exclude']
    )

trends = api.trends_weekly()

但是,我有个错误:

TweepError: [{u'message': u'Sorry, that page does not exist', u'code': 34}]

同时,当我调用为API 1.1更新的trend_place或trend_available时,我没有错误。但是,我不能用这些来做我想做的。在

我是Python和Tweepy的新手,这就是为什么我需要你的帮助。如果有人问过这个问题,请原谅我。在


Tags: 项目函数版本authapijsonbind错误
1条回答
网友
1楼 · 发布于 2024-03-29 09:45:04

您不能再使用trends/weekly,因为它只包含在API v1中,而Twitter现在只支持v1.1(旧版本不再活动)。在

v1 API的actual response of a query告诉您:

{"errors":[{"message":"The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.","code":64}]}

relevant documentation给出了相同的消息:

Deprecation notice! Version 1 of the API is now deprecated. This document may describe an outdated version of the API. Please move to Version 1.1 of the API as soon as possible.

不幸的是,现在没有办法得到这些每周的趋势(除了你自己,随着时间的推移,实际建立一个清单)。Twitter已经不再支持它了。像Topsy这样的站点可能对历史tweet数据很有帮助;我自己从来没有用过它,但是经常看到它的推荐。在

相关问题 更多 >