Fix get_artist when views are missing (closes #33)

This commit is contained in:
sigma67 2020-06-29 14:06:08 +02:00
commit 7d7dc72567
No known key found for this signature in database
GPG key ID: 1545A01D4474BAF0

View file

@ -273,7 +273,8 @@ class YTMusic:
is_key=True)
if descriptionShelf:
artist['description'] = descriptionShelf['description']['runs'][0]['text']
artist['views'] = to_int(descriptionShelf['subheader']['runs'][0]['text'])
artist['views'] = None if 'subheader' not in descriptionShelf else descriptionShelf[
'subheader']['runs'][0]['text']
subscription_button = header['subscriptionButton']['subscribeButtonRenderer']
artist['channelId'] = subscription_button['channelId']
artist['subscribers'] = nav(subscription_button,