Fix for albums without publication year
This commit is contained in:
parent
035a122422
commit
f7971f8199
2 changed files with 7 additions and 4 deletions
|
|
@ -269,8 +269,7 @@ class BrowsingMixin:
|
|||
title = get_item_text(data, 0)
|
||||
thumbnails = nav(data, THUMBNAILS)
|
||||
album_type = get_item_text(data, 1) if release_type == "albums" else "Single"
|
||||
year = get_item_text(data, 1, 2) if release_type == "albums" else get_item_text(
|
||||
data, 1)
|
||||
year = get_item_text(data, 1, 2 if release_type == "albums" else 0, True)
|
||||
albums.append({
|
||||
"browseId": browseId,
|
||||
"artist": artist,
|
||||
|
|
|
|||
|
|
@ -307,9 +307,13 @@ def parse_song_album(data, index):
|
|||
}
|
||||
|
||||
|
||||
def get_item_text(item, index, run_index=0):
|
||||
def get_item_text(item, index, run_index=0, none_if_absent=False):
|
||||
column = get_flex_column_item(item, index)
|
||||
return column if not column else column['text']['runs'][run_index]['text']
|
||||
if not column:
|
||||
return None
|
||||
if none_if_absent and len(column['text']['runs']) < run_index+1:
|
||||
return None
|
||||
return column['text']['runs'][run_index]['text']
|
||||
|
||||
|
||||
def get_flex_column_item(item, index):
|
||||
|
|
|
|||
Loading…
Reference in a new issue