From ac7cd6be68b5d57e7ecaa795a5799631439c06c5 Mon Sep 17 00:00:00 2001 From: sigma67 Date: Sat, 24 Aug 2024 17:59:39 +0200 Subject: [PATCH] fix #640 --- ytmusicapi/parsers/library.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ytmusicapi/parsers/library.py b/ytmusicapi/parsers/library.py index 1e2f279..5474aa1 100644 --- a/ytmusicapi/parsers/library.py +++ b/ytmusicapi/parsers/library.py @@ -121,8 +121,11 @@ def get_library_contents(response, renderer): """ section = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST, True) contents = None - if section is None: # empty library - contents = nav(response, SINGLE_COLUMN + TAB_2_CONTENT + SECTION_LIST_ITEM + renderer, True) + if section is None: # empty library or uploads + # covers the case of non-premium subscribers - no downloads tab + num_tabs = len(nav(response, [*SINGLE_COLUMN, "tabs"])) + LIBRARY_TAB = TAB_1_CONTENT if num_tabs < 3 else TAB_2_CONTENT + contents = nav(response, SINGLE_COLUMN + LIBRARY_TAB + SECTION_LIST_ITEM + renderer, True) else: results = find_object_by_key(section, "itemSectionRenderer") if results is None: