访问:http://box.zhangmen.baidu.com/x?op=12&count=1&title=歌曲名\$$歌手\$$\$$(要去掉中间的3个\) 例如:http://box.zhangmen.baidu.com/x?op=12&count=1&title=东风破\$$周杰伦\$$\$$(要去掉中间的3个\) 返回如下xml格式的结果,<url>标签中的是普通音质,<durl>是高清音质,音乐的地址是<encode>去掉尾巴后加上<decode>组成 如下面普通音质的地址是:http://zhangmenshiting.baidu.com/data2/music/120892918/120892918.mp3?xcode=d857cadf6a270003aeb88cfbc562a9813837498b78c992ab&mid=0.95773781441071
访问:http://tingapi.ting.baidu.com/v1/restserver/ting?from=webapp_music&method=baidu.ting.search.catalogSug&format=json&callback=&query=关键字&_=时间戳
例如:http://tingapi.ting.baidu.com/v1/restserver/ting?from=webapp_music&method=baidu.ting.search.catalogSug&format=json&callback=&query=周杰伦&_=1424071936684
返回如下json格式的结果(这儿只显示了部分结果),每一首歌都对应一个songid,比如我想听安静,songid是10525914,然后通过songid进行第二步解析
{
"song": [
{
"songid": "10525914",
"songname": "安静",
"encrypted_songid": "",
"has_mv": "1",
"yyr_artist": "0",
"artistname": "周杰伦"
},
{
"songid": "10736444",
"songname": "简单爱",
"encrypted_songid": "",
"has_mv": "1",
"yyr_artist": "0",
"artistname": "周杰伦"
},
{
"songid": "580240",
"songname": "夜曲",
"encrypted_songid": "01058da900854dca927",
"has_mv": "0",
"yyr_artist": "0",
"artistname": "周杰伦"
},
{
"songid": "7316935",
"songname": "龙卷风",
"encrypted_songid": "",
"has_mv": "1",
"yyr_artist": "0",
"artistname": "周杰伦"
},
{
"songid": "15779016",
"songname": "稻香",
"encrypted_songid": "0006f0c4c80854d5283d",
"has_mv": "1",
"yyr_artist": "0",
"artistname": "周杰伦"
},
{
"artistid": "109381095",
"artistname": "周杰伦&群星",
"artistpic": "http://b.hiphotos.baidu.com/ting/pic/item/dcc451da81cb39db4b8289e1d2160924aa1830c3.jpg",
"yyr_artist": "0"
}
],
"album": [
{
"albumid": "68674",
"albumname": "我很忙",
"artistname": "周杰伦",
"artistpic": "http://b.hiphotos.baidu.com/ting/pic/item/7af40ad162d9f2d3ff4f6df8abec8a136327cc4f.jpg"
},
{
"albumid": "183906",
"albumname": "七里香(台湾正式版)",
"artistname": "周杰伦",
"artistpic": "http://a.hiphotos.baidu.com/ting/pic/item/3b292df5e0fe9925ff46084536a85edf8db17158.jpg"
}
],
"order": "artist,song,album",
"error_code": 22000
}
访问:http://ting.baidu.com/data/music/links?songIds=songid
比如刚刚搜索到的安静对应的songid是10525914:http://ting.baidu.com/data/music/links?songIds=10525914
返回如下json格式的结果,其中songLink就是歌曲的链接
{
"errorCode": 22000,
"data": {
"xcode": "318c78f3466409467637fd9107335d5f",
"songList": [
{
"queryId": "10525914",
"songId": 10525914,
"songName": "安静",
"artistId": "7994",
"artistName": "周杰伦",
"albumId": 10525799,
"albumName": "他&他 [好男真情歌]",
"songPicSmall": "http://c.hiphotos.baidu.com/ting/pic/item/http://qukufile2.qianqian.com/data2/pic/115534180/115534180.jpg.jpg",
"songPicBig": "http://c.hiphotos.baidu.com/ting/pic/item/http://qukufile2.qianqian.com/data2/pic/115534160/115534160.jpg.jpg",
"songPicRadio": "http://c.hiphotos.baidu.com/ting/pic/item/http://qukufile2.qianqian.com/data2/pic/115534145/115534145.jpg.jpg",
"lrcLink": "/data2/lrc/10546461/10546461.lrc",
"version": "",
"copyType": 1,
"time": 334,
"linkCode": 22000,
"songLink": "http://zhangmenshiting.baidu.com/data2/music/127474116/1052591464800.mp3?xcode=318c78f3466409467519e66d087d4d4c794c02384b2198e1",
"showLink": "http://zhangmenshiting.baidu.com/data2/music/127474116/1052591464800.mp3?xcode=318c78f3466409467519e66d087d4d4c794c02384b2198e1",
"format": "mp3",
"rate": 128,
"size": 5349499,
"relateStatus": "0",
"resourceType": "0"
}
]
}
}