sok.apis.music.deezer_api
Deezer API Implementation Support for music search and metadata.
DeezerApi
class DeezerApi(api_key: str = '')Bases: BaseAPI
Deezer API for music. No API key required for public search.
Initialize Deezer API.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
api_key | str | '' | Not used but required by BaseAPI signature |
Attributes
| Name | Type |
|---|---|
BASE_URL | |
session | Optional[aiohttp.ClientSession] |
supported_content_typesproperty
List[ContentType]
Get supported content types.
supported_media_typesproperty
List[MediaType]
Get supported media types.
get_album_detailsasync
async def get_album_details(album_id: str) -> Dict[str, Any]:Get detailed album information.
Parameters
| Name | Type | Description |
|---|---|---|
album_id | str | Deezer album ID. |
Returns
Dict[str, Any]Dictionary containing album details with tracks.
get_artist_detailsasync
async def get_artist_details(artist_id: str) -> Dict[str, Any]:Get detailed artist information.
Parameters
| Name | Type | Description |
|---|---|---|
artist_id | str | Deezer artist ID. |
Returns
Dict[str, Any]Dictionary containing artist details.
get_detailsasync
async def get_details( item_id: str, content_type: ContentType, **kwargs,) -> Dict[str, Any]:Get detailed information for an item.
Parameters
| Name | Type | Description |
|---|---|---|
item_id | str | Deezer item ID. |
content_type | ContentType | Type of content (ALBUM, ARTIST). |
**kwargs | Additional parameters. |
Returns
Dict[str, Any]Dictionary containing item details.
get_related_itemsasync
async def get_related_items( item_id: str, content_type: ContentType, **kwargs,) -> List[Dict[str, Any]]:Get related items (tracks for an album).
Parameters
| Name | Type | Description |
|---|---|---|
item_id | str | Deezer item ID. |
content_type | ContentType | Type of content. |
**kwargs | Additional parameters. |
Returns
List[Dict[str, Any]]List of tracks for albums, empty list otherwise.
searchasync
async def search( query: str, content_type: ContentType, **kwargs,) -> Dict[str, Any]:Search for music on Deezer.
Parameters
| Name | Type | Description |
|---|---|---|
query | str | Search query string. |
content_type | ContentType | Type of content (ALBUM, ARTIST, TRACK). |
**kwargs | Additional parameters (limit). |
Returns
Dict[str, Any]Dictionary containing search results.
search_albumasync
async def search_album(query: str, limit: int = 20) -> List[Dict[str, Any]]:Search for albums on Deezer.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
query | str | Album search query. | |
limit | int | 20 | Maximum number of results. |
Returns
List[Dict[str, Any]]List of album dictionaries.
search_artistasync
async def search_artist(query: str, limit: int = 20) -> List[Dict[str, Any]]:Search for artists on Deezer.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
query | str | Artist search query. | |
limit | int | 20 | Maximum number of results. |
Returns
List[Dict[str, Any]]List of artist dictionaries.
search_trackasync
async def search_track( query: str, limit: int = 20, title: Optional[str] = None, artist: Optional[str] = None,) -> List[Dict[str, Any]]:Search for tracks on Deezer.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
query | str | Free search text, used without title and artist. | |
limit | int | 20 | Maximum number of results. |
title | Optional[str] | None | Track title, for a precise search. |
artist | Optional[str] | None | Artist name, for a precise search. |
Returns
List[Dict[str, Any]]List of track dictionaries, with their album.