### Tidal Authentication Setup - Bash & Python Source: https://context7.com/uimaxbai/hifi-api/llms.txt Guides users through setting up OAuth device flow authentication with Tidal using the `tidal_auth.py` script. It fetches credentials, initiates browser authentication, and saves tokens. ```Bash cd tidal_auth pip install -r requirements.txt python tidal_auth.py ``` ```Python # The script will: # 1. Fetch valid Tidal API credentials from a GitHub gist # 2. Open a browser for authentication # 3. Poll for authorization completion # 4. Save tokens to token.json # token.json format (supports multiple credentials): [ { "access_token": "eyJhbGciOiJIUzI1...", "refresh_token": "def50200a1b2c3d4...", "userID": 123456789, "client_ID": "zU4XHVVkc2tDPo4t", "client_secret": "VJKhDFqJPqvsPVNBV6ukXTJmwlvbttP7wlMlrc72se4=" } ] ``` -------------------------------- ### Get Track Data with Quality Parameter (API Request Example) Source: https://github.com/uimaxbai/hifi-api/blob/main/README.md Example of a GET request to the /track/ endpoint to retrieve track data. It accepts an optional 'quality' parameter to specify the desired audio quality, defaulting to 'HI_RES_LOSSLESS'. ```http GET /track/?id=48717877&quality=LOSSLESS HTTP/1.1 Host: localhost:8000 ``` -------------------------------- ### Install Tidal Authentication Dependencies (Python) Source: https://github.com/uimaxbai/hifi-api/blob/main/README.md Installs the necessary Python packages for the tidal authentication script. This is a prerequisite for obtaining authentication tokens for the API. ```shell pip install -r requirements.txt ``` -------------------------------- ### Get Track Info (API Request Example) Source: https://github.com/uimaxbai/hifi-api/blob/main/README.md Example of a GET request to the /info/ endpoint to retrieve details about a specific track. Requires the 'id' parameter, which is the Tidal ID of the track. The response includes various metadata about the track. ```http GET /info/?id=48717877 HTTP/1.1 Host: localhost:8000 ``` -------------------------------- ### Run hifi-api Server (Python) Source: https://github.com/uimaxbai/hifi-api/blob/main/README.md Starts the hifi-api web server. By default, it listens on 0.0.0.0:8000. Note that the project currently does not support .env files or environment variables for configuration. ```shell python3 main.py ``` -------------------------------- ### Decoded Manifest (formatted) Source: https://github.com/uimaxbai/hifi-api/blob/main/README.md An example of a decoded XML manifest for media presentation, including track details and segment information. ```APIDOC ## Decoded Manifest (formatted) ### Description This section provides an example of a decoded XML manifest file, typically used in streaming protocols like DASH (Dynamic Adaptive Streaming over HTTP). It contains metadata about the media, including audio codecs, bandwidth, sampling rates, and segment URLs for playback. ### Method (Not applicable - this is a data format representation) ### Endpoint (Not applicable - this is a data format representation) ### Parameters (Not applicable - this is a data format representation) ### Request Example (Not applicable - this is a data format representation) ### Response #### Success Response (200) - **MPD** (object) - The root element of the DASH MPD structure. - **Period** (object) - Represents a period within the media presentation. - **AdaptationSet** (object) - Groups different representations of the same content (e.g., audio, video). - **Representation** (object) - Defines a specific media stream with its characteristics. - **SegmentTemplate** (object) - Specifies how media segments are named and organized. - **SegmentTimeline** (object) - Defines the timing of segments within the media. - **S** (object) - Represents a segment with its duration and repeat count. - **Label** (string) - A human-readable label for the representation (e.g., 'FLAC_HIRES'). #### Response Example ```xml ``` ``` -------------------------------- ### HiFi API Search Endpoint (GET /search/) Source: https://github.com/uimaxbai/hifi-api/blob/main/README.md This describes the GET /search/ endpoint of the HiFi API. It allows users to query for tracks, artists, videos, or playlists using specific parameters. Only one parameter should be specified per request for predictable results. ```http GET /search/?s=TRACK_QUERY GET /search/?a=ARTIST_QUERY GET /search/?v=VIDEO_QUERY GET /search/?p=PLAYLIST_QUERY ``` -------------------------------- ### GET /track/ Source: https://github.com/uimaxbai/hifi-api/blob/main/README.md Retrieves a track with a specified Tidal ID and audio quality. ```APIDOC ## GET /track/ ### Description Retrieves a track with a specified Tidal ID and audio quality. ### Method GET ### Endpoint /track/ ### Parameters #### Query Parameters - **id** (int) - Required - The Tidal ID of the track. - **quality** (str) - Optional, defaults to `HI_RES_LOSSLESS` - The desired audio quality. Options: `HI_RES_LOSSLESS` (up to 24-bit/192kHz FLAC), `LOSSLESS` (16-bit/44.1kHz FLAC), `HIGH` (320kbps AAC), `LOW` (96kbps AAC). ### Response #### Success Response (200 OK) [Details of the success response would go here, typically containing track playback information] ``` -------------------------------- ### Get Similar Albums Source: https://context7.com/uimaxbai/hifi-api/llms.txt Retrieves albums similar to a given album based on genre, style, and other factors. ```APIDOC ## GET /album/similar/ ### Description Retrieves albums similar to a given album based on genre, style, and other factors. ### Method GET ### Endpoint `/album/similar/` #### Query Parameters - **id** (integer) - Required - The ID of the album for which to find similar albums. ### Response #### Success Response (200) - **version** (string) - API version. - **albums** (array) - An array of similar album objects. - **id** (integer) - Album ID. - **title** (string) - Album title. - **cover** (string) - Identifier for the album cover art. - **url** (string) - URL to the album's page on Tidal. #### Response Example ```json { "version": "2.2", "albums": [ { "id": 75210382, "title": "Stories", "cover": "x1y2z3a4-b5c6-d7e8-f9g0-h1i2j3k4l5m6", "url": "http://www.tidal.com/album/75210382" } ] } ``` ``` -------------------------------- ### GET /info/ Source: https://github.com/uimaxbai/hifi-api/blob/main/README.md Retrieves detailed information about a specific track using its Tidal ID. ```APIDOC ## GET /info/ ### Description Retrieves detailed information about a specific track using its Tidal ID. ### Method GET ### Endpoint /info/ ### Parameters #### Query Parameters - **id** (int) - Required - The Tidal ID of the track. ### Response #### Success Response (200 OK) - **version** (str) - The API version. - **data** (object) - Contains detailed track information. - **id** (int) - The Tidal ID of the track. - **title** (str) - The title of the track. - **duration** (int) - The duration of the track in seconds. - **replayGain** (float) - The replay gain value. - **peak** (float) - The peak amplitude of the track. - **allowStreaming** (bool) - Whether streaming is allowed. - **streamReady** (bool) - Whether the stream is ready. - **payToStream** (bool) - Whether payment is required for streaming. - **adSupportedStreamReady** (bool) - Whether ad-supported streaming is available. - **djReady** (bool) - Whether the track is ready for DJ playback. - **stemReady** (bool) - Whether stems are available for the track. - **streamStartDate** (str) - The start date of streaming availability. - **premiumStreamingOnly** (bool) - Whether premium streaming is required. - **trackNumber** (int) - The track number on the album. - **volumeNumber** (int) - The volume number on the album. - **version** (str) - The version of the track (e.g., remix). - **popularity** (int) - The popularity score of the track. - **copyright** (str) - The copyright information. - **bpm** (int) - Beats per minute. - **key** (str) - The musical key of the track. - **keyScale** (str) - The musical scale of the track. - **url** (str) - The URL to the track on Tidal. - **isrc** (str) - The International Standard Recording Code. - **editable** (bool) - Whether the track is editable. - **explicit** (bool) - Whether the track contains explicit content. - **audioQuality** (str) - The audio quality of the track (e.g., LOSSLESS). - **audioModes** (array) - An array of supported audio modes (e.g., STEREO). - **mediaMetadata** (object) - Metadata about the media. - **tags** (array) - An array of media tags. - **upload** (bool) - Whether the track was uploaded. - **accessType** (str) - The access type of the track. - **spotlighted** (bool) - Whether the track is spotlighted. - **artist** (object) - Information about the main artist. - **id** (int) - The artist's ID. - **name** (str) - The artist's name. - **handle** (null) - The artist's handle (currently null). - **type** (str) - The artist's type (e.g., MAIN). - **picture** (str) - The artist's picture identifier. - **artists** (array) - An array of artists associated with the track. - **album** (object) - Information about the album. - **id** (int) - The album's ID. - **title** (str) - The album's title. - **cover** (str) - The album cover identifier. - **vibrantColor** (str) - The vibrant color of the album cover. - **videoCover** (null) - The video cover identifier (currently null). - **mixes** (object) - Information about available mixes. - **TRACK_MIX** (str) - Identifier for the track mix. #### Response Example ```json { "version": "2.0", "data": { "id": 48717877, "title": "Waiting For Love", "duration": 273, "replayGain": -12.41, "peak": 0.999969, "allowStreaming": true, "streamReady": true, "payToStream": false, "adSupportedStreamReady": true, "djReady": true, "stemReady": false, "streamStartDate": "2015-07-10T00:00:00.000+0000", "premiumStreamingOnly": false, "trackNumber": 6, "volumeNumber": 1, "version": "Marshmello Remix", "popularity": 51, "copyright": "℗ 2015 Avicii Music AB", "bpm": 142, "key": "E", "keyScale": "MAJOR", "url": "http://www.tidal.com/track/48717877", "isrc": "CHB701400185", "editable": false, "explicit": false, "audioQuality": "LOSSLESS", "audioModes": [ "STEREO" ], "mediaMetadata": { "tags": [ "LOSSLESS" ] }, "upload": false, "accessType": "PUBLIC", "spotlighted": false, "artist": { "id": 3637201, "name": "Avicii", "handle": null, "type": "MAIN", "picture": "c40836c8-3266-4b00-8274-a2ecb6ccd4ad" }, "artists": [ { "id": 3637201, "name": "Avicii", "handle": null, "type": "MAIN", "picture": "c40836c8-3266-4b00-8274-a2ecb6ccd4ad" } ], "album": { "id": 48717868, "title": "Waiting For Love (Remixes)", "cover": "870a9a38-cd1e-4644-93fd-044aa3be4142", "vibrantColor": "#f3ab4a", "videoCover": null }, "mixes": { "TRACK_MIX": "00190c526a5b574ea83f372447ba67" } } } ``` ``` -------------------------------- ### Get Similar Artists Source: https://context7.com/uimaxbai/hifi-api/llms.txt Retrieves artists similar to a given artist using Tidal's recommendation engine. ```APIDOC ## GET /artist/similar/ ### Description Retrieves artists similar to a given artist using Tidal's recommendation engine. ### Method GET ### Endpoint `/artist/similar/` #### Query Parameters - **id** (integer) - Required - The ID of the artist for whom to find similar artists. ### Response #### Success Response (200) - **version** (string) - API version. - **artists** (array) - An array of similar artist objects. - **id** (integer) - Artist ID. - **name** (string) - Artist name. - **picture** (string) - URL or identifier for the artist's picture. - **url** (string) - URL to the artist's page on Tidal. - **relationType** (string) - The type of relationship (e.g., "SIMILAR_ARTIST"). #### Response Example ```json { "version": "2.2", "artists": [ { "id": 3502730, "name": "Imagine Dragons", "picture": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "url": "http://www.tidal.com/artist/3502730", "relationType": "SIMILAR_ARTIST" } ] } ``` ``` -------------------------------- ### Get Track Information using curl Source: https://context7.com/uimaxbai/hifi-api/llms.txt Retrieves comprehensive metadata for a specific track using a GET request to the /info/ endpoint. Requires a track ID as a query parameter. Returns detailed information including title, duration, audio quality, artist, and album details. ```bash curl -X GET "http://localhost:8000/info/?id=48717877" ``` -------------------------------- ### Get Album Details Source: https://context7.com/uimaxbai/hifi-api/llms.txt Fetches complete album metadata including all tracks. Supports pagination for large albums with configurable limit and offset parameters. ```APIDOC ## GET /album/ ### Description Fetches complete album metadata including all tracks. Supports pagination for large albums with configurable limit and offset parameters. ### Method GET ### Endpoint /album/ #### Query Parameters - **id** (integer) - Required - The ID of the album. - **limit** (integer) - Optional - Maximum number of tracks to return (default: all). - **offset** (integer) - Optional - Number of tracks to skip (default: 0). ### Response #### Success Response (200) - **version** (string) - API version. - **data** (object) - Contains album details. - **id** (integer) - Album ID. - **title** (string) - Album title. - **numberOfTracks** (integer) - Total number of tracks on the album. - **duration** (integer) - Total duration of the album in seconds. - **releaseDate** (string) - Album release date (YYYY-MM-DD). - **cover** (string) - Album cover ID. - **items** (array) - An array of track objects included in the album. - **id** (integer) - Track ID. - **title** (string) - Track title. - **trackNumber** (integer) - Track number on the album. - **duration** (integer) - Track duration in seconds. ### Response Example ```json { "version": "2.2", "data": { "id": 48717868, "title": "Waiting For Love (Remixes)", "numberOfTracks": 11, "duration": 2947, "releaseDate": "2015-07-10", "cover": "870a9a38-cd1e-4644-93fd-044aa3be4142", "items": [ { "id": 48717877, "title": "Waiting For Love", "trackNumber": 6, "duration": 273 } ] } } ``` ``` -------------------------------- ### Get Album Cover Art Source: https://context7.com/uimaxbai/hifi-api/llms.txt Retrieves album cover artwork URLs in multiple resolutions. Can search by track ID or query string. ```APIDOC ## GET /cover/ ### Description Retrieves album cover artwork URLs in multiple resolutions. Can search by track ID or query string. ### Method GET ### Endpoint `/cover/` #### Query Parameters - **id** (integer) - Optional - The track ID to find the cover art for. - **q** (string) - Optional - A search query string to find cover art. ### Response #### Success Response (200) - **version** (string) - API version. - **covers** (array) - An array of cover art objects. - **id** (integer) - The ID associated with the cover art. - **name** (string) - The name associated with the cover art (e.g., album title). - **1280** (string) - URL for the 1280x1280 resolution cover art. - **640** (string) - URL for the 640x640 resolution cover art. - **80** (string) - URL for the 80x80 resolution cover art. #### Response Example ```json { "version": "2.2", "covers": [ { "id": 48717877, "name": "Waiting For Love (Remixes)", "1280": "https://resources.tidal.com/images/870a9a38/cd1e/4644/93fd/044aa3be4142/1280x1280.jpg", "640": "https://resources.tidal.com/images/870a9a38/cd1e/4644/93fd/044aa3be4142/640x640.jpg", "80": "https://resources.tidal.com/images/870a9a38/cd1e/4644/93fd/044aa3be4142/80x80.jpg" } ] } ``` ``` -------------------------------- ### Get Album Details using curl Source: https://context7.com/uimaxbai/hifi-api/llms.txt Fetches complete metadata for a specific album, including all its tracks. Requires an album ID and supports optional limit and offset parameters for pagination. Returns album details such as title, release date, cover art, and a list of tracks. ```bash curl -X GET "http://localhost:8000/album/?id=48717868&limit=100&offset=0" ``` -------------------------------- ### Python Client for HiFi API Source: https://context7.com/uimaxbai/hifi-api/llms.txt Implements a Python client to interact with the HiFi API, including track information retrieval, search functionality, and playback URL generation. It uses httpx for asynchronous HTTP requests and handles base64 decoding for manifest data. The client includes a usage example with error handling and resource cleanup. ```python import httpx import asyncio class TidalClient: def __init__(self, base_url="http://localhost:8000"): self.base_url = base_url self.client = httpx.AsyncClient(timeout=30.0) async def get_track_info(self, track_id: int): response = await self.client.get( f"{self.base_url}/info/", params={"id": track_id} ) response.raise_for_status() return response.json() async def get_track_url(self, track_id: int, quality: str = "HI_RES_LOSSLESS"): response = await self.client.get( f"{self.base_url}/track/", params={"id": track_id, "quality": quality} ) response.raise_for_status() data = response.json() # Decode manifest to get actual audio URL import base64, json manifest_b64 = data["data"]["manifest"] manifest = json.loads(base64.b64decode(manifest_b64)) return manifest["urls"][0] async def search_tracks(self, query: str, limit: int = 25): response = await self.client.get( f"{self.base_url}/search/", params={"s": query} ) response.raise_for_status() return response.json()["data"]["items"] async def close(self): await self.client.aclose() # Usage example async def main(): client = TidalClient() try: # Search for tracks tracks = await client.search_tracks("avicii") print(f"Found {len(tracks)} tracks") if tracks: track_id = tracks[0]["id"] # Get track info info = await client.get_track_info(track_id) print(f"Track: {info['data']['title']}") # Get playback URL url = await client.get_track_url(track_id, quality="LOSSLESS") print(f"Stream URL: {url}") finally: await client.close() asyncio.run(main()) ``` -------------------------------- ### Get Similar Albums - cURL Source: https://context7.com/uimaxbai/hifi-api/llms.txt Retrieves albums similar to a given album based on genre, style, and other factors. Requires the album ID. ```cURL curl -X GET "http://localhost:8000/album/similar/?id=48717868" ``` -------------------------------- ### Get Artist Information Source: https://context7.com/uimaxbai/hifi-api/llms.txt Retrieves artist metadata, album discography, and track listings. Supports two modes: basic artist info or comprehensive discography aggregation. ```APIDOC ## GET /artist/ ### Description Retrieves artist metadata, album discography, and track listings. Supports two modes: basic artist info (using 'id' parameter) or comprehensive discography aggregation (using 'f' parameter). ### Method GET ### Endpoint /artist/ #### Query Parameters - **id** (integer) - Optional - The ID of the artist to retrieve basic information and cover URLs. - **f** (integer) - Optional - The ID of the artist to retrieve comprehensive discography (albums and tracks). ### Response #### Success Response (200) - **version** (string) - API version. - **data** (object) - Contains artist details. Structure varies based on the query parameter used. - If **id** is used: - **id** (integer) - Artist ID. - **name** (string) - Artist name. - **picture** (string) - Artist picture ID. - If **f** is used: - **id** (integer) - Artist ID. - **name** (string) - Artist name. - **albums** (array) - List of albums by the artist. - **id** (integer) - Album ID. - **title** (string) - Album title. - **releaseDate** (string) - Album release date. - **cover** (string) - Album cover ID. - **tracks** (array) - List of tracks on the album. - **id** (integer) - Track ID. - **title** (string) - Track title. - **duration** (integer) - Track duration in seconds. ### Response Example (using 'id') ```json { "version": "2.2", "data": { "id": 8812, "name": "Artist Name", "picture": "artist-picture-id" } } ``` ### Response Example (using 'f') ```json { "version": "2.2", "data": { "id": 8812, "name": "Artist Name", "albums": [ { "id": 12345, "title": "Album Title", "releaseDate": "2020-01-01", "cover": "album-cover-id", "tracks": [ { "id": 67890, "title": "Track Title", "duration": 240 } ] } ] } } ``` ``` -------------------------------- ### GET /artists Source: https://github.com/uimaxbai/hifi-api/blob/main/README.md Retrieves a list of artists with pagination and filtering options. Note: This endpoint may incorrectly return tracks as a known bug. ```APIDOC ## GET /artists ### Description Retrieves a paginated list of artists. This endpoint includes information such as artist ID, name, artist types, URL, picture, popularity, and roles. A known bug causes this endpoint to also return tracks. ### Method GET ### Endpoint /artists ### Query Parameters - **limit** (integer) - Optional - The maximum number of artists to return per page. Defaults to 25. - **offset** (integer) - Optional - The number of artists to skip before starting to collect the result set. Defaults to 0. ### Response #### Success Response (200) - **version** (string) - The API version. - **data** (object) - The main data object. - **artists** (object) - Contains artist-related data. - **limit** (integer) - The limit used for the request. - **offset** (integer) - The offset used for the request. - **totalNumberOfItems** (integer) - The total number of artists available. - **items** (array) - A list of artist objects. - **id** (integer) - The unique identifier for the artist. - **name** (string) - The name of the artist. - **artistTypes** (array) - An array of strings indicating the type of artist (e.g., "ARTIST", "CONTRIBUTOR"). - **url** (string) - The URL of the artist's page. - **picture** (string) - The identifier for the artist's picture. - **selectedAlbumCoverFallback** (string) - Fallback identifier for album cover art. - **popularity** (integer) - A measure of the artist's popularity. - **artistRoles** (array) - An array of objects describing the artist's roles. - **categoryId** (integer) - The ID of the role category. - **category** (string) - The name of the role category (e.g., "Artist", "Producer"). - **mixes** (object) - Contains identifiers for artist mixes. - **ARTIST_MIX** (string) - Identifier for the artist mix. - **handle** (string) - The artist's handle (nullable). - **userId** (string) - The user ID associated with the artist (nullable). - **spotlighted** (boolean) - Indicates if the artist is spotlighted. #### Response Example ```json { "version": "2.0", "data": { "artists": { "limit": 25, "offset": 0, "totalNumberOfItems": 73, "items": [ { "id": 8812, "name": "Coldplay", "artistTypes": [ "ARTIST", "CONTRIBUTOR" ], "url": "http://www.tidal.com/artist/8812", "picture": "b4579672-5b91-4679-a27a-288f097a4da5", "selectedAlbumCoverFallback": null, "popularity": 92, "artistRoles": [ { "categoryId": -1, "category": "Artist" }, { "categoryId": 1, "category": "Producer" }, { "categoryId": 11, "category": "Performer" }, { "categoryId": 2, "category": "Songwriter" }, { "categoryId": 10, "category": "Production team" }, { "categoryId": 99, "category": "Misc" } ], "mixes": { "ARTIST_MIX": "000d63462309f499a611e73b4992bd" }, "handle": null, "userId": null, "spotlighted": false } ] } } } ``` ``` -------------------------------- ### Get Playlist Content Source: https://context7.com/uimaxbai/hifi-api/llms.txt Fetches playlist metadata and all contained tracks. Supports pagination for large playlists. ```APIDOC ## GET /playlist/ ### Description Fetches playlist metadata and all contained tracks. Supports pagination for large playlists. ### Method GET ### Endpoint `/playlist/` #### Query Parameters - **id** (string) - Required - The unique identifier (UUID) of the playlist. - **limit** (integer) - Optional - The maximum number of tracks to return per page. Defaults to a reasonable limit (e.g., 100). - **offset** (integer) - Optional - The number of tracks to skip from the beginning of the playlist. Used for pagination. ### Response #### Success Response (200) - **version** (string) - API version. - **playlist** (object) - Playlist metadata. - **uuid** (string) - Playlist UUID. - **title** (string) - Playlist title. - **numberOfTracks** (integer) - Total number of tracks in the playlist. - **creator** (object) - Information about the playlist creator. - **id** (integer) - Creator's ID. - **items** (array) - An array of track objects included in the playlist. - **item** (object) - Details of a track in the playlist. - **id** (integer) - Track ID. - **title** (string) - Track title. - **artist** (object) - Artist information for the track. - **name** (string) - Artist name. #### Response Example ```json { "version": "2.2", "playlist": { "uuid": "36ea71a8-445e-4a76-bd0f-05092c7a2ec9", "title": "My Playlist", "numberOfTracks": 42, "creator": { "id": 123456 } }, "items": [ { "item": { "id": 48717877, "title": "Waiting For Love", "artist": { "name": "Avicii" } } } ] } ``` ``` -------------------------------- ### Tidal Authentication Script Source: https://context7.com/uimaxbai/hifi-api/llms.txt The tidal_auth.py script handles OAuth device flow authentication with Tidal. It automatically fetches valid client credentials and guides users through browser-based authentication. ```APIDOC ## Tidal Authentication Script ### Description The `tidal_auth.py` script handles OAuth device flow authentication with Tidal. It automatically fetches valid client credentials and guides users through browser-based authentication. ### Usage 1. Navigate to the `tidal_auth` directory. 2. Install dependencies: `pip install -r requirements.txt` 3. Run the script: `python tidal_auth.py` ### Process The script will: 1. Fetch valid Tidal API credentials from a GitHub gist. 2. Open a browser window for user authentication. 3. Poll Tidal's API for authorization completion. 4. Save the obtained access and refresh tokens to `token.json`. ### `token.json` Format The `token.json` file stores authentication tokens and can support multiple credentials. ```json [ { "access_token": "eyJhbGciOiJIUzI1...", "refresh_token": "def50200a1b2c3d4...", "userID": 123456789, "client_ID": "zU4XHVVkc2tDPo4t", "client_secret": "VJKhDFqJPqvsPVNBV6ukXTJmwlvbttP7wlMlrc72se4=" } ] ``` ``` -------------------------------- ### Get Similar Artists - cURL Source: https://context7.com/uimaxbai/hifi-api/llms.txt Retrieves artists similar to a given artist using Tidal's recommendation engine. Requires the artist ID. ```cURL curl -X GET "http://localhost:8000/artist/similar/?id=8812" ``` -------------------------------- ### Get Track Playback URL Source: https://context7.com/uimaxbai/hifi-api/llms.txt Retrieves playback information including the actual audio file URL, manifest data, and quality specifications. ```APIDOC ## GET /track/ ### Description Retrieves playback information including the actual audio file URL, manifest data, and quality specifications. Supports multiple quality levels and returns base64-encoded manifests. ### Method GET ### Endpoint /track/ #### Query Parameters - **id** (integer) - Required - The ID of the track. - **quality** (string) - Optional - Desired audio quality (e.g., LOSSLESS, HI_RES_LOSSLESS, AAC). ### Response #### Success Response (200) - **version** (string) - API version. - **data** (object) - Contains playback details. - **trackId** (integer) - Track ID. - **audioQuality** (string) - Actual audio quality. - **manifestMimeType** (string) - MIME type of the manifest. - **manifest** (string) - Base64 encoded manifest data. - **bitDepth** (integer) - Bit depth of the audio. - **sampleRate** (integer) - Sample rate of the audio. - **trackReplayGain** (number) - Replay Gain value for the track. - **trackPeakAmplitude** (number) - Peak amplitude for the track. ### Response Example ```json { "version": "2.2", "data": { "trackId": 48717877, "audioQuality": "LOSSLESS", "manifestMimeType": "application/vnd.tidal.bts", "manifest": "eyJtaW1lVHlwZSI6ImF1ZGlvL2ZsYWMiLCJjb2RlY3MiOiJmbGFjIiwiZW5jcnlwdGlvblR5cGUiOiJOT05FIiwidXJscyI6WyJodHRwczovL2xnZi5hdWRpby50aWRhbC5jb20vbWVkaWF0cmFja3MvLi4uIl19", "bitDepth": 16, "sampleRate": 44100, "trackReplayGain": -11.07, "trackPeakAmplitude": 0.999969 } } ``` ### Example Usage (Python) ```python import base64 import json manifest_b64 = response_data["data"]["manifest"] manifest_json = json.loads(base64.b64decode(manifest_b64)) audio_url = manifest_json["urls"][0] ``` ``` -------------------------------- ### Get Track Playback URL using curl Source: https://context7.com/uimaxbai/hifi-api/llms.txt Retrieves playback information, including the audio file URL and manifest data, for a specific track. Requires a track ID and desired audio quality (e.g., LOSSLESS) as query parameters. Supports multiple quality levels and returns base64-encoded manifests. ```bash curl -X GET "http://localhost:8000/track/?id=48717877&quality=LOSSLESS" ``` -------------------------------- ### Get Track Information Source: https://context7.com/uimaxbai/hifi-api/llms.txt Retrieves comprehensive metadata for a specific track including title, duration, audio quality, replay gain values, artist details, and album information. ```APIDOC ## GET /info/ ### Description Retrieves comprehensive metadata for a specific track. ### Method GET ### Endpoint /info/ #### Query Parameters - **id** (integer) - Required - The ID of the track. ### Response #### Success Response (200) - **version** (string) - API version. - **data** (object) - Contains track details. - **id** (integer) - Track ID. - **title** (string) - Track title. - **duration** (integer) - Track duration in seconds. - **replayGain** (number) - Replay Gain value. - **peak** (number) - Peak amplitude. - **audioQuality** (string) - Audio quality (e.g., LOSSLESS). - **audioModes** (array of strings) - Supported audio modes (e.g., STEREO). - **artist** (object) - Artist details. - **id** (integer) - Artist ID. - **name** (string) - Artist name. - **picture** (string) - Artist picture ID. - **album** (object) - Album details. - **id** (integer) - Album ID. - **title** (string) - Album title. - **cover** (string) - Album cover ID. ### Response Example ```json { "version": "2.2", "data": { "id": 48717877, "title": "Waiting For Love", "duration": 273, "replayGain": -12.41, "peak": 0.999969, "audioQuality": "LOSSLESS", "audioModes": ["STEREO"], "artist": { "id": 3637201, "name": "Avicii", "picture": "c40836c8-3266-4b00-8274-a2ecb6ccd4ad" }, "album": { "id": 48717868, "title": "Waiting For Love (Remixes)", "cover": "870a9a38-cd1e-4644-93fd-044aa3be4142" } } } ``` ``` -------------------------------- ### Get Artist Information using curl Source: https://context7.com/uimaxbai/hifi-api/llms.txt Retrieves artist metadata and discography. Supports two modes: basic artist information using the 'id' parameter, or comprehensive discography aggregation by providing the 'f' parameter with the artist ID. ```bash # Get basic artist info with cover URLs curl -X GET "http://localhost:8000/artist/?id=8812" # Get artist albums and all tracks curl -X GET "http://localhost:8000/artist/?f=8812" ```