有没有办法访问列表中的所有成员?
目前只能看到前20名会员?
具体来说,我正在使用 python 和 tweepy。
在 Tweepy 中,可以通过使用 Tweepy 提供的 Cursor 类来实现这一点,该类根据您所需的方法调用为返回给您的模型实现适当的迭代器。在你的情况下,你想用list_members()
列表所有者和列表 slug 的方法和参数(请参阅https://dev.twitter.com/docs/api/1/get/lists/members https://dev.twitter.com/docs/api/1/get/lists/members).
示例(修改自http://packages.python.org/tweepy/html/code_snippet.html#pagination http://packages.python.org/tweepy/html/code_snippet.html#pagination):
import tweepy
api = tweepy.API() # Don't forget to use authentication for private lists/users.
# Iterate through all members of the owner's list
for member in tweepy.Cursor(api.list_members, 'list_owner', 'slug').items():
# Do something with member...
我希望我能为您链接一些最新的文档,但我唯一能找到的是这个版本1.4 关于使用游标的文档 http://packages.python.org/tweepy/html/cursor_tutorial.html。此策略仍然是在 Tweepy 中对 Twitter API 资源的结果进行分页/迭代的推荐方法。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)