通过音乐id下载某首音乐,视频编辑场景下优先推荐aac编码,请注意:禁止在服务端缓存音频数据
GET
HFClient client = new DefaultHFClient(url, appkey, secret);
HFTrafficHQListenRequest request = new HFTrafficHQListenRequest();
request.setMethod(HFRequest.METHOD_GET);
request.setClientId("hf2y7jk19a56qetq05");
request.setMusicId("B7B810AABADF");
request.setAudioFormat(AudioFormatEnum.MP3_128.format);
request.setAudioRate(AudioFormatEnum.MP3_128.rate);
try {
HFTrafficHQListenResponse 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=D26BF6F998944FAE2C84C65B4BD5453C' -H 'X-HF-ClientId:hf2y7jk19a56qetq05' -H 'X-HF-AppId:170ae316b9b14c1b9c185988771bde16' -H 'X-HF-Action:TrafficHQListen' -H 'X-HF-Timestamp:1595827081147' -H 'X-HF-Version:V4.2.0' -H 'X-HF-Nonce:vbbVHonjwAHJMXewzexrkLqEEccENnqV'
-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,
"waveUrl": "https://static.hifive.open.haifanwu.com/wave/EM/XCD/EM_XCD_0383/EM_XCD_0383_007.json?sign=941195e31220d8fe1984fb06613a119c&t=1595827081",
"musicId": "B7B810AABADF",
"dynamicLyricUrl": "",
"staticLyricUrl": "",
"fileSize": 7339407
},
"taskId": "6b6d9cb67bb242fdb5be462471ded192"
}