Created
March 3, 2022 05:51
-
-
Save wybiral/7e862c48a883d45f113e1be60af82c0f 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 | |
except: | |
print('Requires python-twitter: pip install python-twitter') | |
exit(1) | |
api = Api( | |
consumer_key='CONSUMER_KEY_HERE', | |
consumer_secret='CONSUMER_SECRET_HERE', | |
access_token_key='ACCESS_TOKEN_KEY_HERE', | |
access_token_secret='ACCESS_TOKEN_SECRET_HERE', | |
) | |
SEARCH_TERMS = [ | |
'#IStandWithPutin', | |
] | |
while True: | |
try: | |
for x in api.GetStreamFilter(track=SEARCH_TERMS): | |
user = x['user'] | |
screen_name = user['screen_name'] | |
bio = user['description'] | |
if bio is None: | |
bio = '' | |
print('User: ' + screen_name) | |
print('Bio: ' + bio) | |
print(x['text']) | |
try: | |
api.CreateBlock(user_id=user['id']) | |
print('\033[91mBLOCKED\033[0m') | |
except KeyboardInterrupt as e: | |
raise e | |
except: | |
pass | |
sleep(0.2) | |
print('') | |
except KeyboardInterrupt: | |
print('') | |
break | |
except: | |
sleep(10) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment