From 10c6cc54d82a554c99d539fb50ec894c04377bb5 Mon Sep 17 00:00:00 2001 From: sigma67 Date: Thu, 14 Jan 2021 23:02:46 +0100 Subject: [PATCH] Fix video search edge case with missing artist IDs (#149) --- ytmusicapi/parsers/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ytmusicapi/parsers/utils.py b/ytmusicapi/parsers/utils.py index 935c9c0..e8dfadc 100644 --- a/ytmusicapi/parsers/utils.py +++ b/ytmusicapi/parsers/utils.py @@ -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