通过音乐id下载某首音乐,视频编辑场景下优先推荐aac编码,请注意:禁止在服务端缓存音频数据
GET
HFClient client = new DefaultHFClient(url, appkey, secret);
HFKHQListenRequest request = new HFKHQListenRequest();
request.setMethod(HFRequest.METHOD_GET);
request.setClientId("hf2y7jk19a56qetq05");
request.setMusicId("B7B810AABADF");
request.setAudioFormat(AudioFormatEnum.MP3_128.format);
request.setAudioRate(AudioFormatEnum.MP3_128.rate);
try {
HFKHQListenResponse response = client.execute(request);
System.out.println(JSON.toJSON(response));
} catch (ApiException e) {
e.printStackTrace();
}
curl - G https: //gateway-open.haifanwu.com -H 'Authorization:HF3-HMAC-SHA1 Signature=05060E577386CE1BB68D676F0F849D1D' -H 'X-HF-ClientId:hf2y7jk19a56qetq05' -H 'X-HF-AppId:170ae316b9b14c1b9c185988771bde16' -H 'X-HF-Action:KHQListen' -H 'X-HF-Timestamp:1595827081147' -H 'X-HF-Version:V4.2.0' -H 'X-HF-Nonce:vbbVENnqVHonEEccjwAHJMXewzexrkLq'
-X GET - d 'MusicId=2F0864DEC7&AudioFormat=mp3&AudioRate=128'
{
"code": 10200,
"msg": "操作成功",
"data": {
"fileUrl": "https://static-hifiveai-open.haifanwu.com/WaterMark/hifive/COPYRIGHT/2F0864DEC7/aac_320/2F0864DEC7.aac?param=2jxMPTguZtCsLRSiZm_ocY2E_AdHCZgGokHaALrP0h6QROHigiY5mzhxWujCZILOI1J7UdyPU66JlNHjs7Jw1ornIX9Sogs20Bz5db4UBXj_wYO3UMhEVJDbG_Y3jNXePbEN3-C9uGOc9AwPkLrl1mmBraqxo_VACIqRz4Oa90c&sign=87987c7b446479f24e07a9c2f28d8885&t=1631007406",
"expires": 1631008006515,
"waveUrl": "https://static-hifiveai-open.haifanwu.com/wave/COPYRIGHT/2F0864DEC7/2F0864DEC7.json?sign=449e9a82cbf92fe7b5532d61797f32c4&t=1631007406",
"musicId": "2F0864DEC7",
"dynamicLyricUrl": "https://static-hifiveai-open.haifanwu.com/lyric/COPYRIGHT/2F0864DEC7/2F0864DEC7.lrc?sign=c6cbaf29de1e2b1b855e8b83d1fbd24f&t=1631007406",
"staticLyricUrl": "",
"fileSize": 9363551,
"subVersions": [{
"path": "https://static-hifiveai-open.haifanwu.com/subVersion/2F0864DEC7/30s/2F0864DEC7.wav?param=SQa_g0QIfghH3T6oBEAZzCxxCkTwcPomeHnhLbqTilNtLLU_-hkgrQ12_WoVERDxiE1ge1jBEvlUou5cV1m4BLNmfZb53oMVifdX825Z3VXfoGvqSNdyN-xDYTiUkwyoe5gUuLo5U6SP7JMM2slWuZe50R1Hx9xzziHaSSN7cMU&sign=ac3dfe92095dc42324b04b54fde10d14&t=1631021334",
"wavePath": "https://static-hifiveai-open.haifanwu.com/subVersion/2F0864DEC7/30s/2F0864DEC7.json?sign=e3cc585c97e8eb05a07576a6a1419cd2&t=1631021334",
"startTime": 51,
"endTime": 78,
"versionName": "30s_128"
}, {
"path": "https://static-hifiveai-open.haifanwu.com/subVersion/2F0864DEC7/60s/2F0864DEC7.wav?param=SQa_g0QIfghH3T6oBEAZzCxxCkTwcPomeHnhLbqTilNtLLU_-hkgrQ12_WoVERDxiE1ge1jBEvlUou5cV1m4BLNmfZb53oMVifdX825Z3VXfoGvqSNdyN-xDYTiUkwyoYQxDxgnKxbunMwfpu8F2uY8wJXrH3SYiH9oNP6NDAA4&sign=ba9ca70cf10d53d95f7c7dbc79829473&t=1631021334",
"wavePath": "https://static-hifiveai-open.haifanwu.com/subVersion/2F0864DEC7/60s/2F0864DEC7.json?sign=2f3264d96c53a6a7efa678ec5b6545e5&t=1631021334",
"startTime": 126,
"endTime": 189,
"versionName": "60s_128"
}, {
"path": "https://static-hifiveai-open.haifanwu.com/subVersion/2F0864DEC7/version_60s_128/2F0864DEC7.mp3?param=SQa_g0QIfghH3T6oBEAZzCxxCkTwcPomeHnhLbqTilNtLLU_-hkgrQ12_WoVERDxiE1ge1jBEvlUou5cV1m4BLNmfZb53oMVifdX825Z3VXfoGvqSNdyN-xDYTiUkwyoXblpVeNgA9V1UHwXl1RHnNHqlQ5oFu_5HmJv_WaGV7A&sign=03a9712899ad982055406458a85ac877&t=1631021334",
"wavePath": "https://static-hifiveai-open.haifanwu.com/subVersion/2F0864DEC7/version_60s_128/2F0864DEC7.json?sign=6a559defb98ae28859ead22d01946d85&t=1631021334",
"startTime": 126,
"endTime": 189,
"versionName": "60s伴奏_128"
}, {
"path": "https://static-hifiveai-open.haifanwu.com/subVersion/2F0864DEC7/version_30s_128/2F0864DEC7.mp3?param=SQa_g0QIfghH3T6oBEAZzCxxCkTwcPomeHnhLbqTilNtLLU_-hkgrQ12_WoVERDxiE1ge1jBEvlUou5cV1m4BLNmfZb53oMVifdX825Z3VXfoGvqSNdyN-xDYTiUkwyolunuKxyk4fmzfx2RcC_1q90DA1OBmHYHzPCbagS320E&sign=894468be9fbfcf3b3e01219d7004632f&t=1631021334",
"wavePath": "https://static-hifiveai-open.haifanwu.com/subVersion/2F0864DEC7/version_30s_128/2F0864DEC7.json?sign=1131e3dc53e736109712c24a76f56df2&t=1631021334",
"startTime": 51,
"endTime": 78,
"versionName": "30s伴奏_128"
}]
},
"taskId": "a8462476d9cb6db1ded1926142f5b7be"
}