Skip to content

Commit b35b29f

Browse files
authored
Add method to get audiobook (#475)
1 parent dc6a88a commit b35b29f

File tree

4 files changed

+13129
-3
lines changed

4 files changed

+13129
-3
lines changed

src/spotifyaio/spotify.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,11 @@ async def get_artist_top_tracks(self, artist_id: str) -> list[Track]:
274274
response = await self._get(f"v1/artists/{identifier}/top-tracks")
275275
return ArtistTopTracksResponse.from_json(response).tracks
276276

277-
# Get an artist's related artists
278-
279-
# Get audiobook
277+
async def get_audiobook(self, audiobook_id: str) -> Audiobook:
278+
"""Get audiobook."""
279+
identifier = get_identifier(audiobook_id)
280+
response = await self._get(f"v1/audiobooks/{identifier}")
281+
return Audiobook.from_json(response)
280282

281283
async def get_audiobooks(self, audiobook_ids: list[str]) -> list[Audiobook]:
282284
"""Get audiobooks."""

0 commit comments

Comments
 (0)