Last active
March 12, 2022 05:14
-
-
Save wybiral/062b692f6f469610641295ca3068b47e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
try: | |
from twitter import Api | |
import twitter | |
except: | |
print('Requires python-twitter: pip install python-twitter') | |
exit(1) | |
api = Api( | |
consumer_key='...', | |
consumer_secret='...', | |
access_token_key='...', | |
access_token_secret='...', | |
) | |
screen_name = 'SCREEN_NAME_HERE' | |
cursor = -1 | |
while True: | |
print(cursor) | |
next_cursor, _, followers = api.GetFollowersPaged( | |
cursor=cursor, | |
count=100, | |
screen_name=screen_name, | |
) | |
for user in followers: | |
print('{} ({})'.format(user.name, user.screen_name)) | |
try: | |
api.CreateBlock(user_id=user.id) | |
except twitter.error.TwitterError as e: | |
pass | |
sleep(0.5) | |
if next_cursor: | |
cursor = next_cursor | |
else: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment