通过音乐id获取时长为15s、128码率的MP3音频格式文件。请注意:禁止在服务端缓存音频数据。
GET
HFClient client = new DefaultHFClient(url, appkey, secret);
HFToolTrialRequest request = new HFToolTrialRequest();
request.setMethod(HFRequest.METHOD_GET);
request.setClientId("hf2y7jk19a56qetq05");
request.setMusicId("125F34E51B0D");
try {
HFToolTrialResponse 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=D9C4123B123FFC9629444C47C5108CD4' -H 'X-HF-ClientId:hf2y7jk19a56qetq05' -H 'X-HF-AppId:170ae316b9b14c1b9c185988771bde16' -H 'X-HF-Action:ToolTrial' -H 'X-HF-Timestamp:1610589350415' -H 'X-HF-Version:V4.2.0' -H 'X-HF-Nonce:WfNCMsocGfiwBtoaewEalhMScsLufAnk'
-X GET - d 'MusicId=125F34E51B0D'
{
"code": 10200,
"msg": "操作成功",
"data": {
"expires": 1610590035863,
"musicId": "125F34E51B0D",
"fileSize": 241206,
"fileUrl": "https://static-hifiveai-open.haifanwu.com/trial/COPYRIGHT/125F34E51B0D/mp3_128/125F34E51B0D.mp3?sign=7e215e09f794821df33cf5786645881a&t=1610589435",
"waveUrl": "https://static-hifiveai-open.haifanwu.com/trial/wave/COPYRIGHT/125F34E51B0D/125F34E51B0D.mp3?sign=2b73591c72cb218729c980068a5bb3b6&t=1610589435",
},
"taskId": "ad47e46387e358e2"
}