diff --git a/README.md b/README.md index 03f52ea..f4da436 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ Suno API currently mainly implements the following APIs: If no IDs are provided, all music will be returned. - `/api/get_limit`: Get quota Info - `/api/extend_audio`: Extend audio length +- `/api/clip`: Get clip information based on ID passed as query parameter `id` ``` For more detailed documentation, please check out the demo site: @@ -170,6 +171,12 @@ def get_quota_information(): return response.json() +def get_clip(clip_id): + url = f"{base_url}/api/clip?id={clip_id}" + response = requests.get(url) + return response.json() + + if __name__ == '__main__': data = generate_audio_by_prompt({ "prompt": "A popular heavy metal song about war, sung by a deep-voiced male singer, slowly and melodiously. The lyrics depict the sorrow of people after the war.", @@ -235,6 +242,12 @@ async function getQuotaInformation() { return response.data; } +async function getClipInformation(clipId) { + const url = `${baseUrl}/api/clip?id=${clipId}`; + const response = await axios.get(url); + return response.data; +} + async function main() { const data = await generateAudioByPrompt({ prompt: diff --git a/src/app/docs/page.tsx b/src/app/docs/page.tsx index 2a53426..24205ba 100644 --- a/src/app/docs/page.tsx +++ b/src/app/docs/page.tsx @@ -29,6 +29,7 @@ export default function Docs() { ids. If no IDs are provided, all music will be returned. - \`/api/get_limit\`: Get quota Info - \`/api/extend_audio\`: Extend audio length +- \`/api/clip\`: Get clip information based on ID passed as query parameter \`id\` \`\`\` Feel free to explore the detailed API parameters and conduct tests on this page. diff --git a/src/lib/SunoApi.ts b/src/lib/SunoApi.ts index dd5c3ae..4a9b2d1 100644 --- a/src/lib/SunoApi.ts +++ b/src/lib/SunoApi.ts @@ -338,6 +338,11 @@ class SunoApi { })); } + /** + * Retrieves information for a specific audio clip. + * @param clipId The ID of the audio clip to retrieve information for. + * @returns A promise that resolves to an object containing the audio clip information. + */ public async getClip(clipId: string): Promise { await this.keepAlive(false); const response = await this.client.get(`${SunoApi.BASE_URL}/api/clip/${clipId}`);