Skip to content

Commit

Permalink
Fix video search edge case with missing artist IDs (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma67 committed Jan 14, 2021
1 parent 2758fc9 commit 10c6cc5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ytmusicapi/parsers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 10c6cc5

Please sign in to comment.