Update get_library_albums parsing to new YT Web display format (closes #84)
Change 'artists' key to dict with name/id
This commit is contained in:
parent
14daa31ab1
commit
5a1032983d
2 changed files with 20 additions and 4 deletions
|
|
@ -92,7 +92,21 @@ class LibraryMixin:
|
|||
Gets the albums in the user's library.
|
||||
|
||||
:param limit: Number of albums to return
|
||||
:return: List of albums
|
||||
:return: List of albums.
|
||||
|
||||
Each item is in the following format:
|
||||
|
||||
{
|
||||
"browseId": "MPREb_G8AiyN7RvFg",
|
||||
"title": "Beautiful",
|
||||
"type": "Album",
|
||||
"thumbnails": [...],
|
||||
"artists": {
|
||||
"name": "Project 46",
|
||||
"id": "UCXFv36m62USAN5rnVct9B4g"
|
||||
},
|
||||
"year": "2015"
|
||||
}
|
||||
"""
|
||||
self._check_auth()
|
||||
body = {'browseId': 'FEmusic_liked_albums'}
|
||||
|
|
|
|||
|
|
@ -51,9 +51,11 @@ def parse_albums(results, upload=True):
|
|||
'id': nav(subtitle, NAVIGATION_BROWSE_ID)
|
||||
})
|
||||
else:
|
||||
album['artists'] = nav(data, SUBTITLE)
|
||||
album['year'] = nav(data, SUBTITLE2)
|
||||
album['trackCount'] = nav(data, SUBTITLE3).split(' ')[0]
|
||||
album['artists'] = {
|
||||
'name': nav(data, SUBTITLE2),
|
||||
'id': nav(data, ['subtitle', 'runs', 2] + NAVIGATION_BROWSE_ID, True)
|
||||
}
|
||||
album['year'] = nav(data, SUBTITLE3)
|
||||
|
||||
albums.append(album)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue