Skip to content

Instantly share code, notes, and snippets.

@codl
Created October 17, 2016 21:08
Show Gist options
  • Select an option

  • Save codl/640e2b7d4d485af4dcae6d6218ef8cd7 to your computer and use it in GitHub Desktop.

Select an option

Save codl/640e2b7d4d485af4dcae6d6218ef8cd7 to your computer and use it in GitHub Desktop.

this script will tell u which of your twitter followers are verified

put your credentials in the TWITTER_TOKEN, TWITTER_SECRET, TWITTER_CONSUMER_KEY and TWITTER_CONSUMER_SECRET environment variables. or in the code if you are a fool

it will definitely break if you have more than 3000 followers because of twitter's rate limits

bye

from twitter import Twitter, OAuth
from os import getenv
t = Twitter(auth=OAuth(
getenv("TWITTER_TOKEN"),
getenv("TWITTER_SECRET"),
getenv("TWITTER_CONSUMER_KEY"),
getenv("TWITTER_CONSUMER_SECRET")
))
myid = t.account.verify_credentials()["id"]
cursor = -1
while cursor != 0:
resp = t.followers.list(user_id=myid, cursor=cursor, count=200, skip_status=1)
cursor = resp["next_cursor"]
for user in resp['users']:
if user['verified']:
print("%s @%s (%s) ✔\nhttps://twitter.com/%s\n" %
(user["name"], user["screen_name"], user["id_str"], user["screen_name"]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment