Skip to content

Commit

Permalink
fix - KeyError: 'profile_banner_url'
Browse files Browse the repository at this point in the history
  • Loading branch information
okkymabruri committed Mar 26, 2022
1 parent b58ad94 commit bf5e88c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion twint/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def User(ur):
_usr.username = ur['data']['user']['legacy']['screen_name']
_usr.bio = ur['data']['user']['legacy']['description']
_usr.location = ur['data']['user']['legacy']['location']
_usr.url = ""
if 'url' in ur['data']['user']['legacy']:
_usr.url = ur['data']['user']['legacy']['url']
_usr.url = ur['data']['user']['legacy']['url']
# parsing date to user-friendly format
_dt = ur['data']['user']['legacy']['created_at']
Expand All @@ -46,7 +49,9 @@ def User(ur):
_usr.is_private = ur['data']['user']['legacy']['protected']
_usr.is_verified = ur['data']['user']['legacy']['verified']
_usr.avatar = ur['data']['user']['legacy']['profile_image_url_https']
_usr.background_image = ur['data']['user']['legacy']['profile_banner_url']
_usr.background_image = ""
if 'profile_banner_url' in ur['data']['user']['legacy']:
_usr.background_image = ur['data']['user']['legacy']['profile_banner_url']
# TODO : future implementation
# legacy_extended_profile is also available in some cases which can be used to get DOB of user
return _usr

0 comments on commit bf5e88c

Please sign in to comment.