【问题标题】:Getting a users entire twitter timeline with tweepy使用 tweepy 获取用户整个 Twitter 时间线
【发布时间】:2012-07-06 07:02:14
【问题描述】:

我正在尝试使用 python 和 tweepy 检索包含我个人 Twitter 状态的全部内容的列表。

我已通过 OAuth 成功进行身份验证,但似乎无法从 twitter 收到超过 800 条状态更新。我的推特简历页面显示我有超过 2000 条推文。我完全在 Twitter 对我们施加的 3200 条推文限制之内。

任何帮助将不胜感激!

这是我当前的代码(减去 OAuth API 身份验证):

for page in tweepy.Cursor(api.user_timeline, count=200).pages(16):
    page_list.append(page)
    n = n+1
    print n

for page in page_list:
    for status in page:
       print status.text

【问题讨论】:

    标签: python twitter tweepy


    【解决方案1】:

    您需要指定 include_rts=True 作为 api.user_timeline 的参数;默认情况下不包括转推。如果你转发了很多东西,这很可能是你丢失的推文去了哪里。

    【讨论】:

    • @Time Bueno 这是否允许解决每位用户 3200 条推文的限制?
    【解决方案2】:

    Twitter 不会返回超过 800 个状态。这写在 Twitter API 文档 (https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline) 中:

    此方法最多只能返回 800 个状态,包括转推, 跨所有页面。

    【讨论】:

    • 注意他使用的是user_timeline,它允许3200
    • 2017 年 11 月 25 日:Twitter API 的链接现已更新。
    猜你喜欢
    • 1970-01-01
    • 2017-07-02
    • 2023-04-08
    • 2020-07-03
    • 1970-01-01
    • 2018-01-12
    • 2013-06-13
    • 1970-01-01
    • 2020-06-05
    相关资源
    最近更新 更多