Added answer to private profile.
This commit is contained in:
parent
dfb09a7255
commit
a9298d5bf2
@ -12,6 +12,8 @@ def main(tweet):
|
|||||||
|
|
||||||
t_username = tweet["t_username"]
|
t_username = tweet["t_username"]
|
||||||
followings = collect_followers.get_followings(t_username)
|
followings = collect_followers.get_followings(t_username)
|
||||||
|
if followings == 'private':
|
||||||
|
twitter_api.reply_to_private(tweet["tweet_id"], t_username)
|
||||||
followings = collect_followers.update_db(followings)
|
followings = collect_followers.update_db(followings)
|
||||||
|
|
||||||
filename = collect_followers.export_followings(followings, t_username)
|
filename = collect_followers.export_followings(followings, t_username)
|
||||||
|
@ -35,6 +35,13 @@ def get_followings(username):
|
|||||||
f"https://api.twitter.com/2/users/{id}/following",
|
f"https://api.twitter.com/2/users/{id}/following",
|
||||||
params = {'pagination_token': pagination_token, "max_results": 1000, 'user.fields': 'description'}
|
params = {'pagination_token': pagination_token, "max_results": 1000, 'user.fields': 'description'}
|
||||||
)
|
)
|
||||||
|
if 'errors' in result:
|
||||||
|
try:
|
||||||
|
error_title = result['errors'][0]['title']
|
||||||
|
if error_title == 'Authorization Error':
|
||||||
|
return ['Private Profile']
|
||||||
|
except:
|
||||||
|
break
|
||||||
if 'data' not in result:
|
if 'data' not in result:
|
||||||
break
|
break
|
||||||
# Append data to list json_response_list.
|
# Append data to list json_response_list.
|
||||||
@ -52,7 +59,7 @@ def update_db(followings):
|
|||||||
""" Update Mastodon username DB. Returns the followings who has a Mastodon hansle in their bio. """
|
""" Update Mastodon username DB. Returns the followings who has a Mastodon hansle in their bio. """
|
||||||
# Create SQL-query.
|
# Create SQL-query.
|
||||||
l = []
|
l = []
|
||||||
tweeters_with_mastodon = ['lasseedfast']
|
tweeters_with_mastodon = []
|
||||||
for i in followings:
|
for i in followings:
|
||||||
m_username = extract_mastodon_handle(i["description"].replace('"', "'")) # Can't be double quotes when sending to SQL.
|
m_username = extract_mastodon_handle(i["description"].replace('"', "'")) # Can't be double quotes when sending to SQL.
|
||||||
if m_username:
|
if m_username:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user