首先获得一个搜索的外链
https://blog.csdn.net/2301_79279502/article/details/135568447
https://aiqicha.baidu.com/qifuknowledge/detail?id=10029779303
https://music.163.com/api/search/get/web?csrf_token=hlpretag=&hlposttag=&s=Asphyxia&type=1&offset=0&total=true&limit=1
使用该接口可以搜索到需要音乐的一条结果
如需修改搜索目标,修改其中参数
s=阿巴阿巴
为需要的歌曲名称即可如需多结果,只修改最后的参数
limit=阿巴阿巴
为需要的结果条数即可
我们得到以下结果:
经过美观输出后分析:
{
"result":
{
"songs":
[
{
"id":
454035505,
"name":
"Asphyxia",
"artists":
[
{
"id":12128251,
"name":"逆时针向",
"picUrl":null,
"alias":[],
"albumSize":0,
"picId":0,
"fansGroup":null,
"img1v1Url":"https://p2.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
}
],
"album":
{
"id":35132652,
"name":"asphyxia",
"artist":
{
"id":0,
"name":"",
"picUrl":null,
"alias":[],
"albumSize":0,
"picId":0,
"fansGroup":null,
}
"id":35132652,
"name":"asphyxia",
"artist":
{
"id":0,
"name":"",
"picUrl":null,
"alias":[],
"albumSize":0,
"picId":0,
"fansGroup":null,
"img1v1Url":"https://p2.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
},
"publishTime":1484537795001,
"size":5,"copyrightId":0,
"status":1,"picId":109951163869607960,
"mark":0},"duration":309818,
"copyrightId":0,
"status":0,
"alias":[],
"rtype":0,"ftype":0,
"transNames":["窒息"],
"mvid":5519061,
"fee":8,
"rUrl":null,
"mark":17180008512
}
],
"songCount":300
},
"code":200
}.
可以看到列表在"songs"关键词之后有一个[]框起来的列表
我们获取列表,之后再在列表里面筛选"id"即可
将关键字提取后的ID合并到.MP3外链模板内:
http://music.163.com/song/media/outer/url?id=这里填入获得的歌曲ID哈哈哈.mp3
即可...