prevent KeyError when parsing missing author data (#788)

`get_album` no longer errors on albums with no artist metadata, instead
returning `"artist": None`

Co-authored-by: sigma67 <sigma67.github@gmail.com>
This commit is contained in:
Solomon 2025-07-24 19:31:49 +00:00 • committed by GitHub
commit 39a480eace
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 5 deletions

View file

@ -135,6 +135,12 @@ class TestBrowsing:
with pytest.raises(Exception, match="Invalid album browseId"):
yt.get_album("asdf")
def test_get_album_without_artist(self, yt):
album = yt.get_album("MPREb_n1AxZ9F8rF7") # soundtrack album with no artist info
assert album["artists"] is None
assert album["audioPlaylistId"] is not None
assert len(album["tracks"]) == 11
def test_get_album_other_versions(self, yt):
# Eminem - Curtain Call: The Hits (Explicit Variant)
album = yt.get_album("MPREb_LQCAymzbaKJ")