get_album: distinguish between "other versions" and "releases for you" (#791)
* parse_album: return audioPlaylistId for Premium users `audioPlaylistId` is no longer `None` when `parse_album` is called with data from a Premium account * get_album: distinguish between "other versions" and "releases for you" adds `related_recommendations`, a list of albums in "Releases for you" `other_versions` no longer contains those recommendations when its carousel is positioned after "Releases for you"
This commit is contained in:
parent
59b3ca5643
commit
7f42e8d5f0
5 changed files with 24 additions and 12 deletions
|
|
@ -109,6 +109,7 @@ class TestBrowsing:
|
|||
def test_get_album(self, yt, yt_auth, sample_album):
|
||||
album = yt_auth.get_album(sample_album)
|
||||
assert len(album) >= 9
|
||||
assert album["related_recommendations"]
|
||||
assert "isExplicit" in album
|
||||
assert album["tracks"][0]["isExplicit"]
|
||||
assert all(item["views"] is not None for item in album["tracks"])
|
||||
|
|
@ -141,13 +142,14 @@ class TestBrowsing:
|
|||
assert album["audioPlaylistId"] is not None
|
||||
assert len(album["tracks"]) == 11
|
||||
|
||||
def test_get_album_other_versions(self, yt):
|
||||
def test_get_album_other_versions(self, yt, yt_oauth):
|
||||
# Eminem - Curtain Call: The Hits (Explicit Variant)
|
||||
album = yt.get_album("MPREb_LQCAymzbaKJ")
|
||||
album = yt_oauth.get_album("MPREb_LQCAymzbaKJ")
|
||||
variants = album["other_versions"]
|
||||
assert len(variants) >= 1 # appears to be regional
|
||||
variant = variants[0]
|
||||
assert variant["type"] == "Album"
|
||||
assert variant["title"] == album["title"]
|
||||
assert len(variant["artists"]) == 1
|
||||
assert variant["artists"][0] == {"name": "Eminem", "id": "UCedvOgsKFzcK3hA5taf3KoQ"}
|
||||
assert variant["audioPlaylistId"] is not None
|
||||
|
|
@ -158,11 +160,13 @@ class TestBrowsing:
|
|||
assert not album["isExplicit"]
|
||||
variant = album["other_versions"][0]
|
||||
assert variant["type"] == "Single"
|
||||
assert variant["title"] == "Prada"
|
||||
assert variant["isExplicit"]
|
||||
assert len(variant["artists"]) == 3
|
||||
assert variant["artists"][0]["id"] == "UCGWMNnI1Ky5bMcRlr73Cj2Q"
|
||||
assert variant["artists"][1]["name"] == "RAYE"
|
||||
assert variant["artists"][2] == {"id": "UCb7jnkQW94hzOoWkG14zs4w", "name": "D-Block Europe"}
|
||||
assert variant["audioPlaylistId"] is not None
|
||||
|
||||
def test_get_song(self, config, yt, yt_oauth, sample_video):
|
||||
song = yt_oauth.get_song(config["uploads"]["private_upload_id"]) # private upload
|
||||
|
|
|
|||
Loading…
Reference in a new issue