【问题标题】:GetUserTimeline can not return ones all timelineGetUserTimeline 无法返回所有时间线
【发布时间】:2017-06-18 08:01:23
【问题描述】:

我正在使用 python-twitter 库,但我无法获取指定用户的所有时间线。

api = twitter.Api(consumer_key='',
                      consumer_secret='',
                      access_token_key='',
                   access_token_secret='')

statuses = api.GetUserTimeline(screen_name = "me", count = 2000)
print len(statues)

总是返回:

200

如何获取一个用户的所有时间线?

【问题讨论】:

    标签: python twitter timeline python-twitter


    【解决方案1】:

    来自python-twitterapi源码https://github.com/bear/python-twitter/blob/master/twitter/api.py

          count (int, optional):
            Specifies the number of statuses to retrieve. May not be
            greater than 200.
    

    一次请求不能获得超过 200 条推文。

    这样您可以检索最后 200 条推文。如果您想获得较旧的推文,则必须使用 since_idmax_id 参数。

          since_id (int, optional):
            Returns results with an ID greater than (that is, more recent
            than) the specified ID. There are limits to the number of
            Tweets which can be accessed through the API. If the limit of
            Tweets has occurred since the since_id, the since_id will be
            forced to the oldest ID available.
          max_id (int, optional):
            Returns only statuses with an ID less than (that is, older
            than) or equal to the specified ID.
    

    【讨论】:

      猜你喜欢
      • 2013-09-28
      • 2013-09-09
      • 2020-10-09
      • 2019-06-13
      • 1970-01-01
      • 1970-01-01
      • 2015-04-19
      • 2018-10-02
      • 1970-01-01
      相关资源
      最近更新 更多