考虑一个拥有100万粉丝的Twitter用户。我想收集这个用户的追随者的随机页面。有什么办法可以做到吗?我不想获得所有关注者的列表,因为这会耗尽我的代币。
我在找这样的东西:
follower_ids = api.followers_ids(user_id, page=page_index)
其中page_index为随机页。
谢谢。
从文档中,您可以获得用户的关注者数量,例如twitterdev
:
https://api.twitter.com/1.1/users/show.json?screen_name=twitterdev
返回followers_count
:
{
...
"followers_count": 143916,
...
}
从那里你可以计算出随机关注者在哪些页面上。
澄清一下,我从未使用过twitter,也没有使用过它的API,只是搜索了一下。
您可以从所有id中选择20个id,例如:
SCREEN_NAME= "the_user_name"
followersIds = api.followers_ids(SCREEN_NAME)
print followersIds[:20]