稳定、快速、免费的 API 接口服务
共收录了
14 个接口
酷狗搜歌排除收费歌曲
接口地址: https://api.zdck8.com/Api/php/kugou
返回格式: JSON
请求方式: GET
请求示例: https://api.zdck8.com/Api/php/kugou?song_name=你好,明天&
请求参数说明:
名称 | 必填 | 说明 |
---|---|---|
song_name | 是 | 你好,明天 |
返回参数说明:
名称 | 类型 | 说明 |
---|---|---|
id | string | 酷狗id |
name | string | 歌曲名称 |
picUrl | string | 歌曲图片 |
mp3url | string | 歌曲直连 |
返回示例:
{ "songs":[ { "id":"72D6803A64016A95D9EB4D2BFFCB13A4", "name":"静水流音、铁脑袋mp3 - 你好,明天", "picUrl":"http://imge.kugou.com/stdmusic/480/20240519/20240519222007323214.jpg", "mp3url":"https://sharefs.tx.kugou.com/202407050156/9eed03d9fa3144b8f7b1bc02405a177e/v3/fab0bfb29bbd64df7e8d011ac1605150/yp/full/a1000_u0_p409_s1415736140.mp3" }] }
错误码格式说明:
名称 | 类型 | 说明 |
---|
PHP代码示例:
$get="https://api.zdck8.com/Api/php/kugou?song_name=你好,明天&"; $result=file_get_contents($get); if($result) { //请求成功 echo $result; }else{ //请求失败 }
$url='https://api.zdck8.com/Api/php/kugou'; $data=array( 'song_name'=>'你好,明天', ); $data=http_build_query($data); $option =array('http'=>array('method'=>'POST','content'=>$data)); $context=stream_context_create($option); $result=file_get_contents($url,false,$context); if($result) { //成功 echo $result; }else{ //失败 }
Java代码示例:
String httpurl = "https://api.zdck8.com/Api/php/kugou?song_name=你好,明天&"; HttpURLConnection connection = null; InputStream is = null; BufferedReader br = null; String result = null; try { URL url = new URL(httpurl); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setConnectTimeout(15000); connection.setReadTimeout(60000); connection.connect(); if (connection.getResponseCode() == 200) { is = connection.getInputStream(); br = new BufferedReader(new InputStreamReader(is, "UTF-8")); StringBuffer sbf = new StringBuffer(); String temp = null; while ((temp = br.readLine()) != null) { sbf.append(temp); } result = sbf.toString(); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (null != br) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } if (null != is) { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } connection.disconnect(); } System.out.println(result);//返回内容
PrintWriter out = null; BufferedReader in = null; String result = ""; String param ="song_name=你好,明天&"; String url ="https://api.zdck8.com/Api/php/kugou?"; try { URL realUrl = new URL(url); URLConnection conn = realUrl.openConnection(); conn.setRequestProperty("accept", "*/*"); conn.setRequestProperty("connection", "Keep-Alive"); conn.setRequestProperty("user-agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); conn.setDoOutput(true); conn.setDoInput(true); out = new PrintWriter(conn.getOutputStream()); out.print(param); out.flush(); in = new BufferedReader( new InputStreamReader(conn.getInputStream())); String line; while ((line = in.readLine()) != null) { result += line; } } catch (Exception e) { System.out.println("发送 POST 请求出现异常!"+e); e.printStackTrace(); } finally{ try{ if(out!=null){ out.close(); } if(in!=null){ in.close(); } } catch(IOException ex){ ex.printStackTrace(); } } System.out.println(result);//返回内容
JavaScript代码示例:
var url = "https://api.zdck8.com/Api/php/kugou?song_name=你好,明天&" var xhrGet = new XMLHttpRequest(); xhrGet.open('GET',url, true); xhrGet.send(); xhrGet.onreadystatechange = function() { if (xhrGet.readyState == 4 && xhrGet.status == 200) { //成功 var result = xhrGet.responseText; console.log(result); } else { //失败 } }
var url ="https://api.zdck8.com/Api/php/kugou"; var data = "song_name=你好,明天&"; var xhrPost = new XMLHttpRequest(); xhrPost.open('POST', url, true); xhrPost.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhrPost.send(data); xhrPost.onreadystatechange = function() { if (xhrPost.readyState == 4 && xhrPost.status == 200) { //成功 var result = xhrPost.responseText; console.log(result); } else { //失败 } }