Fix video search edge case with missing artist IDs (#149)

This commit is contained in:
sigma67 2021-01-14 23:02:46 +01:00
commit 10c6cc54d8
No known key found for this signature in database
GPG key ID: 1545A01D4474BAF0

View file

@ -28,8 +28,10 @@ def get_last_artist_index(runs):
(nav(run, NAVIGATION_BROWSE_ID).startswith('UC') or
nav(run, NAVIGATION_BROWSE_ID).startswith('FEmusic_library_privately_owned_artist')))
except StopIteration: # try to find album if no artist IDs available
if 'navigationEndpoint' in runs[-3]: # has album
if 'navigationEndpoint' in runs[-3] or runs[-3]['text'].endswith('views'): # has album
return len(runs) - 5
elif runs[-1]['text'].endswith('views'):
return len(runs) - 3
else:
return 0