get_album: add other versions (closes #279)
also added isExplicit label to all album type results
This commit is contained in:
parent
c2d5e46805
commit
dd5d753432
4 changed files with 24 additions and 6 deletions
|
|
@ -392,6 +392,15 @@ class BrowsingMixin:
|
|||
}
|
||||
}
|
||||
],
|
||||
"other_versions": [
|
||||
{
|
||||
"title": "Revival",
|
||||
"year": "Eminem",
|
||||
"browseId": "MPREb_fefKFOTEZSp",
|
||||
"thumbnails": [...],
|
||||
"isExplicit": false
|
||||
},
|
||||
],
|
||||
"duration_seconds": 4657
|
||||
}
|
||||
"""
|
||||
|
|
@ -401,6 +410,9 @@ class BrowsingMixin:
|
|||
album = parse_album_header(response)
|
||||
results = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST_ITEM + MUSIC_SHELF)
|
||||
album['tracks'] = parse_playlist_items(results['contents'])
|
||||
results = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST + [1] + CAROUSEL, True)
|
||||
if results is not None:
|
||||
album['other_versions'] = parse_content_list(results['contents'], parse_album)
|
||||
album['duration_seconds'] = sum_total_duration(album)
|
||||
for i, track in enumerate(album['tracks']):
|
||||
album['tracks'][i]['album'] = album['title']
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ THUMBNAILS = ['thumbnail', 'musicThumbnailRenderer'] + THUMBNAIL
|
|||
THUMBNAIL_RENDERER = ['thumbnailRenderer', 'musicThumbnailRenderer'] + THUMBNAIL
|
||||
THUMBNAIL_CROPPED = ['thumbnail', 'croppedSquareThumbnailRenderer'] + THUMBNAIL
|
||||
FEEDBACK_TOKEN = ['feedbackEndpoint', 'feedbackToken']
|
||||
BADGE_LABEL = [
|
||||
'badges', 0, 'musicInlineBadgeRenderer', 'accessibilityData', 'accessibilityData', 'label'
|
||||
]
|
||||
BADGE_PATH = [0, 'musicInlineBadgeRenderer', 'accessibilityData', 'accessibilityData', 'label']
|
||||
BADGE_LABEL = ['badges'] + BADGE_PATH
|
||||
SUBTITLE_BADGE_LABEL = ['subtitleBadges'] + BADGE_PATH
|
||||
CATEGORY_TITLE = ['musicNavigationButtonRenderer', 'buttonText'] + RUN_TEXT
|
||||
CATEGORY_PARAMS = ['musicNavigationButtonRenderer', 'clickCommand', 'browseEndpoint', 'params']
|
||||
MRLIR = 'musicResponsiveListItemRenderer'
|
||||
|
|
|
|||
|
|
@ -205,7 +205,8 @@ def parse_album(result):
|
|||
'title': nav(result, TITLE_TEXT),
|
||||
'year': nav(result, SUBTITLE2, True),
|
||||
'browseId': nav(result, TITLE + NAVIGATION_BROWSE_ID),
|
||||
'thumbnails': nav(result, THUMBNAIL_RENDERER)
|
||||
'thumbnails': nav(result, THUMBNAIL_RENDERER),
|
||||
'isExplicit': nav(result, SUBTITLE_BADGE_LABEL, True) is not None
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue