Przejdź do głównej treści

Documentation Index

Fetch the complete documentation index at: https://docs.xhuoapi.ai/llms.txt

Use this file to discover all available pages before exploring further.

SUNO pozwala nam uzyskać oficjalny link MP4 do wygenerowanej muzyki, ten dokument wyjaśnia metody integracji odpowiednich API. Ten API ma tylko jeden parametr wejściowy, którym jest audio_id, jest to oficjalnie wygenerowane ID utworu. Tutaj wprowadzamy audio_id, które wynosi 275113ab-fe5c-4bca-a33c-0cca96b39fa6.
import requests

url = "https://api.xhuoapi.ai/v1/suno/mp4"

headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}",
    "content-type": "application/json"
}

payload = {
    "audio_id": "275113ab-fe5c-4bca-a33c-0cca96b39fa6"
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)
Wynik jest następujący:
{
  "success": true,
  "task_id": "03ae7cca-c3a2-40a0-98b2-8f33426af438",
  "trace_id": "848d8d5a-d6bb-4e16-bb29-768c22cf1b3b",
  "data": {
    "video_url": "https://cdn1.suno.ai/275113ab-fe5c-4bca-a33c-0cca96b39fa6.mp4"
  }
}
Można zauważyć, że pole video_url w data to link do pliku MP4 odpowiadającego temu utworowi.