通过音乐id下载某首音乐,视频编辑场景下优先推荐aac编码,请注意:禁止在服务端缓存音频数据。
GET
HFClient client = new DefaultHFClient(url, appkey, secret);
HFToolHQListenRequest request = new HFToolHQListenRequest();
request.setMethod(HFRequest.METHOD_GET);
request.setClientId("hf2y7jk19a56qetq05");
request.setMusicId("B7B810AABADF");
request.setAudioFormat(AudioFormatEnum.MP3_128.format);
request.setAudioRate(AudioFormatEnum.MP3_128.rate);
try {
HFToolHQListenResponse 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=4990D250C8F94F9E7A9AB35A71FED5A0' -H 'X-HF-ClientId:hf2y7jk19a56qetq05' -H 'X-HF-AppId:170ae316b9b14c1b9c185988771bde16' -H 'X-HF-Action:ToolHQListen' -H 'X-HF-Timestamp:1595827081147' -H 'X-HF-Version:V4.2.0' -H 'X-HF-Nonce:ENnqVHonjwAHJMXvbbVewzexrkLqEEcc'
-X GET - d 'MusicId=B7B810AABADF&AudioFormat=mp3&AudioRate=320'
{
"code": 10200,
"msg": "操作成功",
"data": {
"fileUrl": "https://static-hifiveai-open.haifanwu.com/WaterMark/hifive/EM/XCD/mp3_320/EM_XCD_0383/EM_XCD_0383_007.mp3?sign=c99ca01ca4a8e49dab9a7ac24411c40f&t=1595827081",
"expires": 1595827681732,
"musicId": "B7B810AABADF",
"dynamicLyricUrl": "",
"staticLyricUrl": "",
"waveUrl": "https://static.hifive.open.haifanwu.com/wave/EM/XCD/EM_XCD_0383/EM_XCD_0383_007.json?sign=941195e31220d8fe1984fb06613a119c&t=1595827081",
"fileSize": 7339407,
},
"taskId": "be462471ded1926b6d9cb6db7bb242f5"
}