我正在使用此功能从 id 获取所有关注者:
def getAllFollowers(id):
followers = tweepy.Cursor(api.followers, id = id)
temp = []
for user in followers.items():
temp.append(user)
return temp
有没有办法在不分页的情况下获得关注者、朋友、推文等的数量?只有号码。
我正在使用此功能从 id 获取所有关注者:
def getAllFollowers(id):
followers = tweepy.Cursor(api.followers, id = id)
temp = []
for user in followers.items():
temp.append(user)
return temp
有没有办法在不分页的情况下获得关注者、朋友、推文等的数量?只有号码。
用户对象具有followers_count
,friends_count
和statuses_count
这些属性。请参阅 Twitter API 文档中的示例响应:https ://dev.twitter.com/overview/api/users
此帐户当前拥有的关注者数量。在某些胁迫条件下,该字段将暂时显示“0”。例子:
"followers_count": 21
试试我的追随者计数解决方案 https://gist.github.com/3879338 在此代码中,您需要粘贴您的数据,例如 consumer_key、consumer_secret、access_key、access_secret。
使用用户对象中的“followers_count”:
handle = 'justinbieber'
user = api.get_user(handle)
num_followers = user.followers_count
num_friends = user.friends_count