From 2b7f3b027ebd2a14d12badf88ca5e980c687fac4 Mon Sep 17 00:00:00 2001 From: sigma67 Date: Mon, 25 May 2020 16:24:38 +0200 Subject: [PATCH] get_library_upload_songs: add default value None for keys 'artist', 'album' --- ytmusicapi/parsers.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/ytmusicapi/parsers.py b/ytmusicapi/parsers.py index d6e49fc..403c8d5 100644 --- a/ytmusicapi/parsers.py +++ b/ytmusicapi/parsers.py @@ -135,9 +135,16 @@ def parse_playlist_items(results): like = None if 'menu' in data: - like = data['menu']['menuRenderer']['topLevelButtons'][0]['likeButtonRenderer']['likeStatus'] + like = data['menu']['menuRenderer']['topLevelButtons'][0]['likeButtonRenderer'][ + 'likeStatus'] - song = {'videoId': videoId, 'title': title, 'artists': artists, 'album': album, 'likeStatus': like} + song = { + 'videoId': videoId, + 'title': title, + 'artists': artists, + 'album': album, + 'likeStatus': like + } if duration: song['duration'] = duration if setVideoId: @@ -166,7 +173,13 @@ def parse_uploaded_items(results): title = get_item_text(data, 0) - song = {'entityId': entityId, 'videoId': videoId, 'title': title} + song = { + 'entityId': entityId, + 'videoId': videoId, + 'title': title, + 'artist': None, + 'album': None + } if get_flex_column_item(data, 1): song['artist'] = parse_song_artists(data, 1) song['album'] = parse_song_album(data, 2)