h
This commit is contained in:
13
API/hifi.py
13
API/hifi.py
@@ -18,6 +18,7 @@ class HifiApiClient:
|
||||
- GET /search/ with exactly one of s, a, v, p
|
||||
- GET /track/ with id (and optional quality)
|
||||
- GET /info/ with id
|
||||
- GET /album/ with id
|
||||
- GET /lyrics/ with id
|
||||
"""
|
||||
|
||||
@@ -68,6 +69,18 @@ class HifiApiClient:
|
||||
|
||||
return self._get_json("info/", params={"id": track_int})
|
||||
|
||||
def album(self, album_id: int) -> Dict[str, Any]:
|
||||
"""Fetch album details, including track list when provided by the backend."""
|
||||
|
||||
try:
|
||||
album_int = int(album_id)
|
||||
except Exception as exc:
|
||||
raise HifiApiError(f"album_id must be int-compatible: {exc}") from exc
|
||||
if album_int <= 0:
|
||||
raise HifiApiError("album_id must be positive")
|
||||
|
||||
return self._get_json("album/", params={"id": album_int})
|
||||
|
||||
def lyrics(self, track_id: int) -> Dict[str, Any]:
|
||||
"""Fetch lyrics (including subtitles/LRC) for a track."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user