0

出于研究目的,我正在尝试检索 Twitter 页面。但问题是,如果该页面包含超过 20 条消息,它只会在开头显示前 20 条消息。只有在您向下拖动页面后,它才会向您显示更多内容。而我目前的代码只有前 20 个 :( 请帮助我,谢谢!

f = urllib.urlopen("http://twitter.com/%s/status/%s" % (uid, sid))

一个例子是https://twitter.com/DeanoLP/status/304476010257211394

4

1 回答 1

3

如果您使用 python twitter api 包装器查询 twitter,您的生活可能会更轻松:http ://code.google.com/p/python-twitter/

import twitter
api = twitter.Api()
statuses = api.GetUserTimeline(uid, count=200)

count 参数确定要检索的状态数(最大值=200)。

注意:您可以通过 pip 快速轻松地安装此模块,但请务必使用:

pip install python-twitter

不是

pip install twitter

这是一个不同的包装。

于 2013-02-21T23:28:54.340 回答