GetUserTimeline不能返回所有TimeIn中的

2024-04-26 13:38:48 发布

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

我正在使用pythontwitter库,但是我无法获得指定用户的所有时间线。你知道吗

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

如何获取一个用户的所有时间线?你知道吗


Tags: key用户nametokenapisecretaccessconsumer
1条回答
网友
1楼 · 发布于 2024-04-26 13:38:48

来自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条tweet。你知道吗

这样你就可以检索最后的200条tweet。如果你想得到更老的tweet,你必须使用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.

相关问题 更多 >