Closed johangm90 closed 8 years ago
look at http://music.163.com/#/song?id=1045123, it's already 404.
Maybe it is playlsit? http://music.163.com/#/playlist?id=1045123
Then you should use playlist API
$result = $api->playlist('1045123');
var_dump($result);
/*
object(stdClass)#28 (3) {
["playlist"] => object(stdClass)#2 (28) {
["subscribers"] => array(0) {
}
["subscribed"] => bool(false)
["creator"] => object(stdClass)#3 (24) {
["signature"] => string(0) ""
["authority"] => int(0)
["defaultAvatar"] => bool(true)
["avatarImgId"] => int(1986817511391283)
["province"] => int(110000)
["authStatus"] => int(0)
["followed"] => bool(false)
["avatarUrl"] => string(69) "http://p4.music.126.net/bTIoFKFaE1-JQpgN3OynGg==/1986817511391283.jpg"
["accountStatus"] => int(0)
["gender"] => int(0)
["city"] => int(110101)
["birthday"] => int(-2209017600000)
["userId"] => int(861127)
["userType"] => int(0)
["nickname"] => string(18) "血色铸就荣耀"
["description"] => string(0) ""
["detailDescription"] => string(0) ""
["backgroundImgId"] => int(2002210674180199)
["backgroundUrl"] => string(69) "http://p1.music.126.net/VTW4vsN08vwL3uSQqPyHqg==/2002210674180199.jpg"
["mutual"] => bool(false)
["expertTags"] => NULL
["djStatus"] => int(0)
["vipType"] => int(0)
["remarkName"] => NULL
}
["tracks"] => array(3) {
[0] => object(stdClass)#4 (30) {
["name"] => string(6) "坦诚"
["id"] => int(31246383)
["pst"] => int(0)
["t"] => int(0)
["ar"] => array(1) {
[0] => object(stdClass)#5 (2) {
["id"] => int(10371)
["name"] => string(9) "姚贝娜"
}
}
["alia"] => array(0) {
}
["pop"] => float(95)
["st"] => int(0)
["rt"] => NULL
["fee"] => int(0)
["v"] => int(40)
["crbt"] => NULL
["cf"] => string(0) ""
["al"] => object(stdClass)#6 (4) {
["id"] => int(3115406)
["name"] => string(6) "永存"
["pic_str"] => string(16) "7831821325258766"
["pic"] => int(7831821325258766)
}
["dt"] => int(298000)
["h"] => object(stdClass)#7 (4) {
["br"] => int(320000)
["fid"] => int(7869204720667024)
["size"] => int(11929768)
["vd"] => float(0)
}
["m"] => object(stdClass)#8 (4) {
["br"] => int(160000)
["fid"] => int(7869204720667025)
["size"] => int(5964969)
["vd"] => float(0)
}
["l"] => object(stdClass)#9 (4) {
["br"] => int(96000)
["fid"] => int(7869204720667026)
["size"] => int(3579049)
["vd"] => float(0)
}
["a"] => NULL
["cd"] => string(0) ""
["no"] => int(1)
["rtUrl"] => NULL
["ftype"] => int(0)
["rtUrls"] => array(0) {
}
["mst"] => int(9)
["cp"] => int(36024)
["mv"] => int(0)
["rtype"] => int(0)
["rurl"] => NULL
["privilege"] => object(stdClass)#10 (15) {
["id"] => int(31246383)
["fee"] => int(0)
["payed"] => int(0)
["st"] => int(0)
["pl"] => int(320000)
["dl"] => int(320000)
["sp"] => int(7)
["cp"] => int(1)
["subp"] => int(1)
["cs"] => bool(false)
["maxbr"] => int(999000)
["fl"] => int(320000)
["pc"] => NULL
["toast"] => bool(false)
["flag"] => int(0)
}
}
[1] => object(stdClass)#11 (30) {
["name"] => string(55) "Canon (Over a Basso Ostinato) 钢琴二重奏版卡农"
["id"] => int(5188837)
["pst"] => int(0)
["t"] => int(0)
["ar"] => array(1) {
[0] => object(stdClass)#12 (2) {
["id"] => int(236952)
["name"] => string(12) "Peerless 2x2"
}
}
["alia"] => array(0) {
}
["pop"] => float(100)
["st"] => int(1)
["rt"] => string(0) ""
["fee"] => int(0)
["v"] => int(136)
["crbt"] => NULL
["cf"] => string(0) ""
["al"] => object(stdClass)#13 (4) {
["id"] => int(508055)
["name"] => string(44) "Pachelbel's Greatest Hit: The Ultimate Canon"
["pic_str"] => string(16) "1773512255614659"
["pic"] => int(1773512255614659)
}
["dt"] => int(202657)
["h"] => object(stdClass)#14 (4) {
["br"] => int(320000)
["fid"] => int(5656987325004579)
["size"] => int(8143804)
["vd"] => float(1.65704)
}
["m"] => object(stdClass)#15 (4) {
["br"] => int(160000)
["fid"] => int(1247945697568835)
["size"] => int(4090646)
["vd"] => float(2.12225)
}
["l"] => object(stdClass)#16 (4) {
["br"] => int(96000)
["fid"] => int(1297423720833106)
["size"] => int(2468964)
["vd"] => float(2.03168)
}
["a"] => NULL
["cd"] => string(0) ""
["no"] => int(3)
["rtUrl"] => NULL
["ftype"] => int(0)
["rtUrls"] => array(0) {
}
["mst"] => int(9)
["cp"] => int(5003)
["mv"] => int(0)
["rtype"] => int(0)
["rurl"] => NULL
["privilege"] => object(stdClass)#17 (15) {
["id"] => int(5188837)
["fee"] => int(0)
["payed"] => int(0)
["st"] => int(0)
["pl"] => int(320000)
["dl"] => int(320000)
["sp"] => int(7)
["cp"] => int(1)
["subp"] => int(1)
["cs"] => bool(false)
["maxbr"] => int(320000)
["fl"] => int(320000)
["pc"] => NULL
["toast"] => bool(false)
["flag"] => int(0)
}
}
[2] => object(stdClass)#18 (30) {
["name"] => string(52) "Canon of the Three Stars 现代版电子合成卡农"
["id"] => int(5188838)
["pst"] => int(0)
["t"] => int(0)
["ar"] => array(1) {
[0] => object(stdClass)#19 (2) {
["id"] => int(0)
["name"] => string(11) "Isao Tomita"
}
}
["alia"] => array(0) {
}
["pop"] => float(75)
["st"] => int(1)
["rt"] => string(0) ""
["fee"] => int(0)
["v"] => int(136)
["crbt"] => NULL
["cf"] => string(0) ""
["al"] => object(stdClass)#20 (4) {
["id"] => int(508055)
["name"] => string(44) "Pachelbel's Greatest Hit: The Ultimate Canon"
["pic_str"] => string(16) "1773512255614659"
["pic"] => int(1773512255614659)
}
["dt"] => int(347000)
["h"] => object(stdClass)#21 (4) {
["br"] => int(320000)
["fid"] => int(1989016534658777)
["size"] => int(13921012)
["vd"] => float(3.13443)
}
["m"] => object(stdClass)#22 (4) {
["br"] => int(160000)
["fid"] => int(1989016534658778)
["size"] => int(6979233)
["vd"] => float(3.45436)
}
["l"] => object(stdClass)#23 (4) {
["br"] => int(96000)
["fid"] => int(1989016534658779)
["size"] => int(4202103)
["vd"] => float(3.49628)
}
["a"] => NULL
["cd"] => string(0) ""
["no"] => int(4)
["rtUrl"] => NULL
["ftype"] => int(0)
["rtUrls"] => array(0) {
}
["mst"] => int(9)
["cp"] => int(7001)
["mv"] => int(0)
["rtype"] => int(0)
["rurl"] => NULL
["privilege"] => object(stdClass)#24 (15) {
["id"] => int(5188838)
["fee"] => int(0)
["payed"] => int(0)
["st"] => int(0)
["pl"] => int(320000)
["dl"] => int(320000)
["sp"] => int(7)
["cp"] => int(1)
["subp"] => int(1)
["cs"] => bool(false)
["maxbr"] => int(320000)
["fl"] => int(320000)
["pc"] => NULL
["toast"] => bool(false)
["flag"] => int(0)
}
}
}
["trackIds"] => array(3) {
[0] => object(stdClass)#25 (2) {
["id"] => int(31246383)
["v"] => int(40)
}
[1] => object(stdClass)#26 (2) {
["id"] => int(5188837)
["v"] => int(136)
}
[2] => object(stdClass)#27 (2) {
["id"] => int(5188838)
["v"] => int(136)
}
}
["cloudTrackCount"] => int(0)
["adType"] => int(0)
["trackNumberUpdateTime"] => int(1428143747912)
["playCount"] => int(0)
["trackCount"] => int(3)
["coverImgId"] => int(3408486047336473)
["trackUpdateTime"] => int(1459743927702)
["privacy"] => int(0)
["userId"] => int(861127)
["newImported"] => bool(false)
["specialType"] => int(5)
["createTime"] => int(1369316596884)
["highQuality"] => bool(false)
["updateTime"] => int(1428143747912)
["commentThreadId"] => string(14) "A_PL_0_1045123"
["status"] => int(0)
["description"] => NULL
["tags"] => array(0) {
}
["subscribedCount"] => int(0)
["name"] => string(33) "血色铸就荣耀喜欢的音乐"
["id"] => int(1045123)
["shareCount"] => int(0)
["commentCount"] => int(0)
}
["code"] => int(200)
["privileges"] => array(3) {
[0] => object(stdClass)#29 (14) {
["id"] => int(31246383)
["fee"] => int(0)
["payed"] => int(0)
["st"] => int(0)
["pl"] => int(320000)
["dl"] => int(320000)
["sp"] => int(7)
["cp"] => int(1)
["subp"] => int(1)
["cs"] => bool(false)
["maxbr"] => int(999000)
["fl"] => int(320000)
["toast"] => bool(false)
["flag"] => int(0)
}
[1] => object(stdClass)#30 (14) {
["id"] => int(5188837)
["fee"] => int(0)
["payed"] => int(0)
["st"] => int(0)
["pl"] => int(320000)
["dl"] => int(320000)
["sp"] => int(7)
["cp"] => int(1)
["subp"] => int(1)
["cs"] => bool(false)
["maxbr"] => int(320000)
["fl"] => int(320000)
["toast"] => bool(false)
["flag"] => int(0)
}
[2] => object(stdClass)#31 (14) {
["id"] => int(5188838)
["fee"] => int(0)
["payed"] => int(0)
["st"] => int(0)
["pl"] => int(320000)
["dl"] => int(320000)
["sp"] => int(7)
["cp"] => int(1)
["subp"] => int(1)
["cs"] => bool(false)
["maxbr"] => int(320000)
["fl"] => int(320000)
["toast"] => bool(false)
["flag"] => int(0)
}
}
}
*/
It work!
$result = $api->search('faded', 1, 5);
{
"result":{
"songs":[
{
"id":36990266,
"name":"Faded",
"artists":[
{
"id":1045123,
"name":"Alan Walker",
"picUrl":null,
"alias":[
],
"albumSize":0,
"picId":0,
"img1v1Url":"http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
}
],
"album":{
"id":3406843,
"name":"Faded",
"artist":{
"id":0,
"name":"",
"picUrl":null,
"alias":[
],
"albumSize":0,
"picId":0,
"img1v1Url":"http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
},
"publishTime":1448380800007,
"size":2,
"copyrightId":7001,
"status":3,
"picId":18277181788626198
},
"duration":212626,
"copyrightId":7001,
"status":3,
"alias":[
],
"rtype":0,
"ftype":0,
"mvid":524116,
"fee":8,
"rUrl":null
},
{
"id":407677659,
"name":"Faded (Conor Maynard Cover)",
"artists":[
{
"id":29020,
"name":"Conor Maynard",
"picUrl":null,
"alias":[
],
"albumSize":0,
"picId":0,
"img1v1Url":"http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
},
{
"id":1045123,
"name":"Alan Walker",
"picUrl":null,
"alias":[
],
"albumSize":0,
"picId":0,
"img1v1Url":"http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
},
{
"id":0,
"name":"ANTH",
"picUrl":null,
"alias":[
],
"albumSize":0,
"picId":0,
"img1v1Url":"http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
}
],
"album":{
"id":34589188,
"name":"Faded (Conor Maynard Cover)",
"artist":{
"id":0,
"name":"",
"picUrl":null,
"alias":[
],
"albumSize":0,
"picId":0,
"img1v1Url":"http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
},
"publishTime":1458662400007,
"size":0,
"copyrightId":0,
"status":0,
"picId":1408474398849316
},
"duration":202814,
"copyrightId":0,
"status":0,
"alias":[
],
"rtype":0,
"ftype":0,
"mvid":0,
"fee":0,
"rUrl":null
},
{
"id":405343998,
"name":"Faded(LaRry Rong Remix)",
"artists":[
{
"id":1059001,
"name":"Alan Walker,LaRry Rong",
"picUrl":null,
"alias":[
],
"albumSize":0,
"picId":0,
"img1v1Url":"http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
}
],
"album":{
"id":34512719,
"name":"Alan Walker - Faded(LaRry Rong Remix)",
"artist":{
"id":0,
"name":"",
"picUrl":null,
"alias":[
],
"albumSize":0,
"picId":0,
"img1v1Url":"http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
},
"publishTime":1457456939764,
"size":2,
"copyrightId":0,
"status":1,
"picId":16638909463690881
},
"duration":218827,
"copyrightId":0,
"status":0,
"alias":[
],
"rtype":0,
"ftype":0,
"mvid":0,
"fee":0,
"rUrl":null
},
{
"id":404184010,
"name":"Faded (Restrung)",
"artists":[
{
"id":1045123,
"name":"Alan Walker",
"picUrl":null,
"alias":[
],
"albumSize":0,
"picId":0,
"img1v1Url":"http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
}
],
"album":{
"id":34502012,
"name":"Faded (Restrung)",
"artist":{
"id":0,
"name":"",
"picUrl":null,
"alias":[
],
"albumSize":0,
"picId":0,
"img1v1Url":"http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
},
"publishTime":1455206400007,
"size":1,
"copyrightId":7001,
"status":3,
"picId":1376588559477103
},
"duration":217106,
"copyrightId":7001,
"status":3,
"alias":[
],
"rtype":0,
"ftype":0,
"mvid":5289044,
"fee":8,
"rUrl":null
},
{
"id":406070395,
"name":"Faded(英雄联盟台词版)",
"artists":[
{
"id":1081326,
"name":"DJ Ricardo",
"picUrl":null,
"alias":[
],
"albumSize":0,
"picId":0,
"img1v1Url":"http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
}
],
"album":{
"id":34512835,
"name":"Faded (英雄联盟台词版)",
"artist":{
"id":0,
"name":"",
"picUrl":null,
"alias":[
],
"albumSize":0,
"picId":0,
"img1v1Url":"http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1":0,
"trans":null
},
"publishTime":1457669901800,
"size":0,
"copyrightId":0,
"status":1,
"picId":16657601161393132
},
"duration":213715,
"copyrightId":0,
"status":0,
"alias":[
],
"rtype":0,
"ftype":0,
"mvid":0,
"fee":0,
"rUrl":null
}
],
"songCount":5728
},
"code":200
}```
$result = $api->url(36990266, 320000);
```json
{
"data":[
{
"id":36990266,
"url":null,
"br":0,
"size":0,
"md5":null,
"code":404,
"expi":1200,
"type":null,
"gain":0.0,
"fee":0,
"uf":null,
"payed":0,
"flag":0,
"canExtend":false
}
],
"code":200
}
I belive Neetease block all none chinese ip addresses. Try proxy.
{
"data": [
{
"id": 36990266,
"url": "http://m8.music.126.net/20160804124406/8f105b85c9a8b77ea197fd19776dffc4/ymusic/0bec/75a9/a09c/e37e93fe58eac7ae44df445d2f8874f0.mp3",
"br": 128000,
"size": 3403066,
"md5": "e37e93fe58eac7ae44df445d2f8874f0",
"code": 200,
"expi": 1200,
"type": "mp3",
"gain": -1.93,
"fee": 8,
"uf": null,
"payed": 0,
"flag": 0,
"canExtend": false
}
],
"code": 200
}
Here are my post data, hope to help you.
$url='http://music.163.com/weapi/song/enhance/player/url?csrf_token=';
/*
array(2) {
["params"] => string(108) "WtHJsgHhDCYHATOlGd+o7x1LuVDWPXm0S90UDAbHv429KNZan0xwb8xKHS18vGdIcnrFVSHPJmV2KhARwnZQH+TPCRHNjCoeSIm+PH9fpEk="
["encSecKey"] => string(256) "7619ea114c8f19a15854f8e47e3ac687fcb42397e76876deb852a82f58251cc19b63189caf07eaee3414cd281a9d7d2fb05acf24717c1e4b5be23982a951ce059a155814988f617478dc29ff00f8dc02e61daba1b677d7a392a97060b5015a327cc58eccf5d57fd408536c8a21823b1d2e49f1a3275b24bff6e6a03202ccde85"
}
*/
thank you
some songs return null result {"data":[{"id":1045123,"url":null,"br":0,"size":0,"md5":null,"code":404,"expi":1200,"type":null,"gain":0.0,"fee":0,"uf":null,"payed":0,"flag":0,"canExtend":false}],"code":200}