From 57528ffbdd94bf04ce902c67c7f99515b6ce13fa Mon Sep 17 00:00:00 2001 From: sigma67 Date: Wed, 18 Aug 2021 15:40:01 +0200 Subject: [PATCH] Add fallback for parsing album audioPlaylistId (#219, closes #220) --- ytmusicapi/parsers/albums.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ytmusicapi/parsers/albums.py b/ytmusicapi/parsers/albums.py index 5d2aed1..84c35cf 100644 --- a/ytmusicapi/parsers/albums.py +++ b/ytmusicapi/parsers/albums.py @@ -25,7 +25,9 @@ def parse_album_header(response): # add to library/uploaded menu = nav(header, MENU) toplevel = menu['topLevelButtons'] - album['audioPlaylistId'] = nav(toplevel, [0, 'buttonRenderer'] + NAVIGATION_WATCH_PLAYLIST_ID) + album['audioPlaylistId'] = nav(toplevel, [0, 'buttonRenderer'] + NAVIGATION_WATCH_PLAYLIST_ID, True) + if not album['audioPlaylistId']: + album['audioPlaylistId'] = nav(toplevel, [0, 'buttonRenderer'] + NAVIGATION_PLAYLIST_ID, True) service = nav(toplevel, [1, 'buttonRenderer', 'defaultServiceEndpoint'], True) if service: album['likeStatus'] = parse_like_status(service)