if mastodon_username

This commit is contained in:
Lasse Studion 2022-12-21 17:28:10 +01:00
parent 9d6581d5c7
commit 965b0b6f0c

View File

@ -34,12 +34,13 @@ def stream():
try: try:
twitter_username = json_response['includes']['users'][0]['username'] twitter_username = json_response['includes']['users'][0]['username']
mastodon_username = extract_mastodon_handle(json_response['includes']['tweets'][0]['text']) mastodon_username = extract_mastodon_handle(json_response['includes']['tweets'][0]['text'])
print(mastodon_username) if mastodon_username:
source_tweet = str(json_response['data']['id']) print(mastodon_username)
# Add Mastodon username to db. source_tweet = str(json_response['data']['id'])
db.insert_user(twitter_username, mastodon_username, source_tweet) # Add Mastodon username to db.
db.insert_user(twitter_username, mastodon_username, source_tweet)
except KeyError: except:
pass pass