Skip to content

Instantly share code, notes, and snippets.

@wybiral
Created March 3, 2022 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wybiral/7e862c48a883d45f113e1be60af82c0f to your computer and use it in GitHub Desktop.
Save wybiral/7e862c48a883d45f113e1be60af82c0f to your computer and use it in GitHub Desktop.
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