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.
|
Gets the albums in the user's library.
|
||||||
|
|
||||||
:param limit: Number of albums to return
|
: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()
|
self._check_auth()
|
||||||
body = {'browseId': 'FEmusic_liked_albums'}
|
body = {'browseId': 'FEmusic_liked_albums'}
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,11 @@ def parse_albums(results, upload=True):
|
||||||
'id': nav(subtitle, NAVIGATION_BROWSE_ID)
|
'id': nav(subtitle, NAVIGATION_BROWSE_ID)
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
album['artists'] = nav(data, SUBTITLE)
|
album['artists'] = {
|
||||||
album['year'] = nav(data, SUBTITLE2)
|
'name': nav(data, SUBTITLE2),
|
||||||
album['trackCount'] = nav(data, SUBTITLE3).split(' ')[0]
|
'id': nav(data, ['subtitle', 'runs', 2] + NAVIGATION_BROWSE_ID, True)
|
||||||
|
}
|
||||||
|
album['year'] = nav(data, SUBTITLE3)
|
||||||
|
|
||||||
albums.append(album)
|
albums.append(album)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue