根据他们的文档:
API.user_timeline([id/user_id/screen_name][, since_id][, max_id][, count][, page])
Returns the 20 most recent statuses posted from the authenticating user or the user specified. It’s also possible to request another user’s timeline via the id parameter.
那么,如何从一个人的时间轴中获得20条以上的推文?该文档未显示如何...该用户是否需要认证?
您可以在中使用pages
参数API.user_timeline([id/user_id/screen_name][, since_id][, max_id][, count][, page])
。对于page
值1,您将从用户时间轴中获取一组最新的20条推文,然后在进一步迭代中,当我们增加的值时,page = 2
该方法将返回其他20条推文,这些推文比从第1页接收的最早的推文还旧。可以认为是:
假设您的帐户中有120条Tweet(第1条Tweet是最早的Tweet,第120条Tweet是最新的),然后:
page = 1
会返回(100,120]
page = 2
会返回(80,100]... 等等
希望您现在有了页面的概念,现在该实现这些东西了。
no_of_pages = int(raw_input("Please enter the number of tweets: "))
for i in xrange(no_of_pages):
API.user_timeline("@anmoluppal366", page = i)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句