2012-08-05 63 views
2

我使用這個函數從一個ID獲得所有的追隨者:如何使用Tweepy獲取關注者數量(無分頁)?

def getAllFollowers(id): 
    followers = tweepy.Cursor(api.followers, id = id) 
    temp = [] 
    for user in followers.items(): 
     temp.append(user) 

    return temp 

有沒有辦法讓追隨者,或朋友,微博等的數量...沒有分頁? 只有號碼。

回答

3

用戶對象具有followers_count,friends_countstatuses_count這些屬性。請參閱Twitter API文檔中的示例回覆:https://dev.twitter.com/overview/api/users

此帳戶當前擁有的關注者數量。在某些脅迫條件下,該字段將暫時指示「0」。例如:

"followers_count": 21

2

試試我的解決方案,爲計數的追隨者 https://gist.github.com/3879338 在這段代碼中,你需要糊狀CONSUMER_KEY,CONSUMER_SECRET,access_key,access_secret您的數據。

相關問題