Twitter API - Get Followers Followers

I am trying to get the number of followers of each follower for a particular account (in order to find the most influential followers). I use Tweepy in Python, but I run into API speed limits and I can only get the number of followers for 5 followers before I disconnect. The account I'm looking at has about 2,000 subscribers. Is there any way around this?

my code snippet

ids = api.followers_ids(account_name) for id in ids: more = api.followers_ids(id) print len(more) 

thanks

+4
source share
1 answer

You do not need to get all user subscribers to count them. Use the followers_count property. For instance:.

 import tweepy auth = tweepy.OAuthHandler(..., ...) auth.set_access_token(..., ...) api = tweepy.API(auth) for user in tweepy.Cursor(api.followers, screen_name="twitter").items(): print user.screen_name, user.followers_count 

Print

 ... pizzerialoso 0 Mario98Y 0 sumankumarjana 1 realattorneylaw 3056 JaluSeptyan 10 andhita_khanza 18 ... 

Hope this helps.

+6
source

Source: https://habr.com/ru/post/1489516/


All Articles