Skip to content

Commit

Permalink
fix #640
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma67 committed Aug 24, 2024
1 parent 7d062c2 commit ac7cd6b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ytmusicapi/parsers/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ac7cd6b

Please sign in to comment.