Viorel
Viorel

Reputation: 39

How to get a list with my Twitter Followers?

I am trying to get a list with the names of all my Twitter followers. Using the below code I can withdraw only 200 followers name.

I know the count parameter can get up to 200 value, but Does anyone know how to withdraw more?

from twython import Twython
import csv

APP_KEY=...
...
OAUTH_TOKEN_SECRET=...

twitter = Twython(APP_KEY, APP_SECRET,
                  OAUTH_TOKEN, OAUTH_TOKEN_SECRET)

followers = twitter.get_followers_list(screen_name="x", count=200)
following = twitter.get_friends_ids(screen_name="x")
with open("twitter4.csv", 'w', newline='') as csvfile:
    writer = csv.writer(csvfile, delimiter=',')
    writer.writerow(["name", "tweets", "following", "followers", "I'm following"])
    for e in followers["users"]:
        writer.writerow([e["screen_name"], e["statuses_count"], e["friends_count"], e["followers_count"],
                         e["id"] in following["ids"]])

Upvotes: 0

Views: 170

Answers (0)

Related Questions