mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Handle AttributeError
This commit is contained in:
parent
7e4a7d8576
commit
ee403a5301
6
twoot.py
6
twoot.py
|
@ -193,10 +193,16 @@ def update_profile(nitter_url, soup, sql, mast_password):
|
|||
db = sql.cursor()
|
||||
|
||||
# Extract avatar picture address
|
||||
try:
|
||||
new_avatar_url = soup.find('div', class_='profile-card-info').findChild('a').findChild('img').get('src')
|
||||
except AttributeError:
|
||||
new_avatar_url = None
|
||||
|
||||
# Extract banner picture address
|
||||
try:
|
||||
new_banner_url = soup.find('div', class_='profile-banner').findChild('a').findChild('img').get('src')
|
||||
except AttributeError:
|
||||
new_banner_url = None
|
||||
|
||||
# Get the original urls of the avatar and banner pictures on the account profile
|
||||
db.execute("SELECT avatar_url, banner_url FROM profiles WHERE mastodon_instance=? AND mastodon_account=?", (TOML['config']['mastodon_instance'], TOML['config']['mastodon_user'],))
|
||||
|
|
Loading…
Reference in New Issue
Block a user