Home >php教程 >PHP源码 >百度音乐API

百度音乐API

PHP中文网
PHP中文网Original
2016-05-26 08:18:261870browse

1. [代码]搜索歌曲API   

搜索歌曲API:http://www.php.cn/{0}&ie=utf-8&page={1}

{0}=需要搜索的歌曲或歌手

{1}=页码数(第一页就是0,第二页是1)

返回的是一个html网页,需要分析网页,得到歌曲ID,歌曲名,歌手,专辑等 属性

歌曲详细API:http://www.php.cn/{0}

{0}=从上面的结果的中分析的歌曲的ID

返回结果 看下面

{
"errorCode":22000,
"data":
{
"xcode":"17173bd17415d2c22a7250ec29f7e010",
"songList":[{
"queryId":"247911654",
"songId":247911654,
"songName":"\u590f\u6d1b\u7279\u70e6\u607c",
"artistId":"5913",
"artistName":"\u91d1\u5fd7\u6587",
"albumId":247911669,
"albumName":"\u590f\u6d1b\u7279\u70e6\u607c",
"songPicSmall":"http:\/\/musicdata.baidu.com\/data2\/pic\/247910612\/247910612.jpg",
"songPicBig":"http:\/\/musicdata.baidu.com\/data2\/pic\/247910608\/247910608.jpg",
"songPicRadio":"http:\/\/musicdata.baidu.com\/data2\/pic\/247910603\/247910603.jpg",
"lrcLink":"\/data2\/lrc\/248241445\/248241445.lrc",
"version":"\u5f71\u89c6\u539f\u58f0",
"copyType":0,
"time":192,
"linkCode":22000,
"songLink":"http:\/\/yinyueshiting.baidu.com\/data2\/music\/247912201\/247911654108000128.mp3?xcode=17173bd17415d2c221ec55f2ef944ac8",
"showLink":"http:\/\/yinyueshiting.baidu.com\/data2\/music\/247912201\/247911654108000128.mp3?xcode=17173bd17415d2c221ec55f2ef944ac8",
"format":"mp3",
"rate":128,
"size":3078749,
"relateStatus":"0",
"resourceType":"0",
"source":"web"
}
]
}
}

里面有歌曲图片,歌曲地址,歌词地址

歌曲地址里如果有http://www.php.cn/和http://www.php.cn/ 那就需要将http://www.php.cn/给去掉

歌词地址:http://www.php.cn/+获取到的url


2. [图片] qrcode_for_gh_6b7d4c098efc_258.jpg               

百度音乐API

                                           

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn