网易音乐API
本次分析的是网易音乐API
歌曲搜索API:http://music.163.com/api/search/get/web?csrf_token=
需要用POST来获取
参数:
Referer=http://music.163.com/search/
hlposttag=</span>
hlpretag=<span class=\”s-fc7\”>
limit=返回结果数量
offset=(当前页码-1)*返回结果数量
s=需要搜索的歌曲或歌手
total=如果是第一页就是True否则Flase
type=1
返回结果
{ "result": { "songCount": 200, "songs": [ { "id": 186001, "name": "七里香", "artists": [ { "id": 6452, "name": "周杰伦", "picUrl": null, "alias": [], "albumSize": 0, "picId": 0, "trans": null, "img1v1Url": "http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg", "img1v1": 0 } ], "album": { "id": 18903, "name": "七里香", "artist": { "id": 0, "name": "", "picUrl": null, "alias": [], "albumSize": 0, "picId": 0, "trans": null, "img1v1Url": "http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg", "img1v1": 0 }, "publishTime": 1091462400000, "size": 10, "copyrightId": 1007, "status": 1, "picId": 102254581384072 }, "duration": 299000, "copyrightId": 1007, "status": 3, "alias": [], "fee": 0, "mvid": 185014, "rtype": 1, "rUrl": "http://wap.118100.cn/ca/ps/5347/1150000019", "ftype": 1 }, { "id": 186125, "name": "开不了口", "artists": [ { "id": 6452, "name": "周杰伦", "picUrl": null, "alias": [], "albumSize": 0, "picId": 0, "trans": null, "img1v1Url": "http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg", "img1v1": 0 } ], "album": { "id": 18915, "name": "范特西", "artist": { "id": 0, "name": "", "picUrl": null, "alias": [], "albumSize": 0, "picId": 0, "trans": null, "img1v1Url": "http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg", "img1v1": 0 }, "publishTime": 1000915200000, "size": 10, "copyrightId": 1007, "status": 1, "picId": 59373627912203 }, "duration": 285000, "copyrightId": 1007, "status": 3, "alias": [], "fee": 0, "mvid": 143050, "rtype": 1, "rUrl": "http://wap.118100.cn/ca/ps/5347/1150000040", "ftype": 1 }, { "id": 186055, "name": "回到过去", "artists": [ { "id": 6452, "name": "周杰伦", "picUrl": null, "alias": [], "albumSize": 0, "picId": 0, "trans": null, "img1v1Url": "http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg", "img1v1": 0 } ], "album": { "id": 18907, "name": "八度空间", "artist": { "id": 0, "name": "", "picUrl": null, "alias": [], "albumSize": 0, "picId": 0, "trans": null, "img1v1Url": "http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg", "img1v1": 0 }, "publishTime": 1026921600000, "size": 10, "copyrightId": 1007, "status": 1, "picId": 5953855464827125 }, "duration": 231000, "copyrightId": 1007, "status": 3, "alias": [], "fee": 0, "mvid": 154014, "rtype": 1, "rUrl": "http://wap.118100.cn/ca/ps/5347/1150000008", "ftype": 1 }, { "id": 185815, "name": "蒲公英的约定", "artists": [ { "id": 6452, "name": "周杰伦", "picUrl": null, "alias": [], "albumSize": 0, "picId": 0, "trans": null, "img1v1Url": "http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg", "img1v1": 0 } ], "album": { "id": 18886, "name": "我很忙", "artist": { "id": 0, "name": "", "picUrl": null, "alias": [], "albumSize": 0, "picId": 0, "trans": null, "img1v1Url": "http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg", "img1v1": 0 }, "publishTime": 1193846400000, "size": 10, "copyrightId": 1007, "status": 1, "picId": 60473139533046 }, "duration": 247000, "copyrightId": 1007, "status": 3, "alias": [], "fee": 0, "mvid": 0, "rtype": 1, "rUrl": "http://wap.118100.cn/ca/ps/5347/1150000036", "ftype": 1 }, { "id": 186109, "name": "世界末日", "artists": [ { "id": 6452, "name": "周杰伦", "picUrl": null, "alias": [], "albumSize": 0, "picId": 0, "trans": null, "img1v1Url": "http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg", "img1v1": 0 } ], "album": { "id": 18914, "name": "Fantasy Plus", "artist": { "id": 0, "name": "", "picUrl": null, "alias": [], "albumSize": 0, "picId": 0, "trans": null, "img1v1Url": "http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg", "img1v1": 0 }, "publishTime": 1009468800000, "size": 3, "copyrightId": 1007, "status": 1, "picId": 130841883712118 }, "duration": 265000, "copyrightId": 1007, "status": 1, "alias": [], "fee": 0, "mvid": 154013, "rtype": 1, "rUrl": "http://wap.118100.cn/ca/ps/5347/1150000011", "ftype": 1 } ] }, "code": 200 }
这样就可以获取到歌曲播放地址和图片地址了
歌词API:http://music.163.com/api/song/lyric/
POST形式发送
参数
os=pc
id=歌曲ID
lv=-1
kv=-1
tv=-1
直接返回歌词内容
大家可以利用这个接口做一个可以微信点歌的类似微点歌:vdiange
这样的微信公众号
大家可以添加微点歌:vdiange
大家可以添加微点歌:vdiange
测试一下音乐接口效果。
本文来自博客园,作者:大象已无形,转载请注明原文链接:https://www.cnblogs.com/mmm/p/163_music_api.html