parent
404f1dadae
commit
3ce5b8facf
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
/*!
|
/**
|
||||||
* Meting music framework
|
* Meting music framework
|
||||||
* https://i-meto.com
|
* https://i-meto.com
|
||||||
* https://github.com/metowolf/Meting
|
* https://github.com/metowolf/Meting
|
||||||
* Version 1.3.10
|
* Version 1.4.0
|
||||||
*
|
*
|
||||||
* Copyright 2017, METO Sheel <i@i-meto.com>
|
* Copyright 2018, METO Sheel <i@i-meto.com>
|
||||||
* Released under the MIT license
|
* Released under the MIT license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -25,21 +25,22 @@ class Meting
|
||||||
|
|
||||||
public function site($v)
|
public function site($v)
|
||||||
{
|
{
|
||||||
$suppose=array('netease','tencent','xiami','kugou','baidu');
|
$suppose = array('netease', 'tencent', 'xiami', 'kugou', 'baidu');
|
||||||
$this->_SITE=in_array($v,$suppose)?$v:'netease';
|
$this->_SITE = in_array($v,$suppose) ? $v : 'netease';
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cookie($v = '')
|
public function cookie($v = '')
|
||||||
{
|
{
|
||||||
if (!empty($v)) {
|
if (!empty($v)) {
|
||||||
$this->_TEMP['cookie']=$v;
|
$this->_TEMP['cookie'] = $v;
|
||||||
}
|
}
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function format($v = true)
|
public function format($v = true)
|
||||||
{
|
{
|
||||||
$this->_FORMAT=$v;
|
$this->_FORMAT = $v;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,17 +49,17 @@ class Meting
|
||||||
if (isset($API['encode'])) {
|
if (isset($API['encode'])) {
|
||||||
$API=call_user_func_array(array($this,$API['encode']), array($API));
|
$API=call_user_func_array(array($this,$API['encode']), array($API));
|
||||||
}
|
}
|
||||||
$BASE=$this->curlset();
|
$BASE = $this->curlset();
|
||||||
$curl=curl_init();
|
$curl = curl_init();
|
||||||
if ($API['method']=='POST') {
|
if ($API['method'] == 'POST') {
|
||||||
if (is_array($API['body'])) {
|
if (is_array($API['body'])) {
|
||||||
$API['body']=http_build_query($API['body']);
|
$API['body'] = http_build_query($API['body']);
|
||||||
}
|
}
|
||||||
curl_setopt($curl, CURLOPT_POST, 1);
|
curl_setopt($curl, CURLOPT_POST, 1);
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $API['body']);
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $API['body']);
|
||||||
} elseif ($API['method']=='GET') {
|
} elseif ($API['method'] == 'GET') {
|
||||||
if (isset($API['body'])) {
|
if (isset($API['body'])) {
|
||||||
$API['url']=$API['url'].'?'.http_build_query($API['body']);
|
$API['url'] = $API['url'].'?'.http_build_query($API['body']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
curl_setopt($curl, CURLOPT_HEADER, 0);
|
curl_setopt($curl, CURLOPT_HEADER, 0);
|
||||||
|
@ -70,13 +71,20 @@ class Meting
|
||||||
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
|
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
|
||||||
curl_setopt($curl, CURLOPT_URL, $API['url']);
|
curl_setopt($curl, CURLOPT_URL, $API['url']);
|
||||||
curl_setopt($curl, CURLOPT_COOKIE, isset($this->_TEMP['cookie'])?$this->_TEMP['cookie']:$BASE['cookie']);
|
curl_setopt($curl, CURLOPT_COOKIE, isset($this->_TEMP['cookie'])?$this->_TEMP['cookie']:$BASE['cookie']);
|
||||||
curl_setopt($curl, CURLOPT_REFERER, $BASE['referer']);
|
curl_setopt($curl, CURLOPT_HTTPHEADER, [
|
||||||
curl_setopt($curl, CURLOPT_USERAGENT, $BASE['useragent']);
|
'Accept: */*',
|
||||||
|
'Accept-Encoding: gzip, deflate',
|
||||||
|
'Accept-Language: zh-CN,zh;q=0.8,gl;q=0.6,zh-TW;q=0.4',
|
||||||
|
'Connection: keep-alive',
|
||||||
|
'Content-Type: application/x-www-form-urlencoded',
|
||||||
|
'Referer: ' . $BASE['referer'],
|
||||||
|
'User-Agent: ' . $BASE['useragent']
|
||||||
|
]);
|
||||||
for ($i=0;$i<=$this->_RETRY;$i++) {
|
for ($i=0;$i<=$this->_RETRY;$i++) {
|
||||||
$data=curl_exec($curl);
|
$data = curl_exec($curl);
|
||||||
$info=curl_getinfo($curl);
|
$info = curl_getinfo($curl);
|
||||||
$error=curl_errno($curl);
|
$error = curl_errno($curl);
|
||||||
$status=$error?curl_error($curl):'';
|
$status = $error ? curl_error($curl) : '';
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -91,25 +99,25 @@ class Meting
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($this->_FORMAT&&isset($API['decode'])) {
|
if ($this->_FORMAT && isset($API['decode'])) {
|
||||||
$data=call_user_func_array(array($this,$API['decode']), array($data));
|
$data = call_user_func_array(array($this,$API['decode']), array($data));
|
||||||
}
|
}
|
||||||
if ($this->_FORMAT&&isset($API['format'])) {
|
if ($this->_FORMAT && isset($API['format'])) {
|
||||||
$data=json_decode($data, 1);
|
$data = json_decode($data, 1);
|
||||||
$data=$this->clean($data, $API['format']);
|
$data = $this->clean($data, $API['format']);
|
||||||
$data=json_encode($data);
|
$data = json_encode($data);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function pickup($array, $rule)
|
private function pickup($array, $rule)
|
||||||
{
|
{
|
||||||
$t=explode('#', $rule);
|
$t = explode('#', $rule);
|
||||||
foreach ($t as $vo) {
|
foreach ($t as $vo) {
|
||||||
if (!isset($array[$vo])){
|
if (!isset($array[$vo])){
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
$array=$array[$vo];
|
$array = $array[$vo];
|
||||||
}
|
}
|
||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
@ -117,30 +125,30 @@ class Meting
|
||||||
private function clean($raw, $rule)
|
private function clean($raw, $rule)
|
||||||
{
|
{
|
||||||
if (!empty($rule)) {
|
if (!empty($rule)) {
|
||||||
$raw=$this->pickup($raw, $rule);
|
$raw = $this->pickup($raw, $rule);
|
||||||
}
|
}
|
||||||
if (!isset($raw[0])&&sizeof($raw)) {
|
if (!isset($raw[0]) && sizeof($raw)) {
|
||||||
$raw=array($raw);
|
$raw = array($raw);
|
||||||
}
|
}
|
||||||
$result=array_map(array($this,'format_'.$this->_SITE), $raw);
|
$result = array_map(array($this,'format_'.$this->_SITE), $raw);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function search($keyword, $page=1, $limit=30)
|
public function search($keyword, $option = null)
|
||||||
{
|
{
|
||||||
switch ($this->_SITE) {
|
switch ($this->_SITE) {
|
||||||
case 'netease':
|
case 'netease':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'http://music.163.com/api/linux/forward',
|
'url' => 'http://music.163.com/api/linux/forward',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'params' => array(
|
'params' => array(
|
||||||
's' => $keyword,
|
's' => $keyword,
|
||||||
'type' => 1,
|
'type' => isset($option['type']) ? $option['type'] : 1,
|
||||||
'limit' => $limit,
|
'limit' => isset($option['limit']) ? $option['limit'] : 30,
|
||||||
'total' => 'true',
|
'total' => 'true',
|
||||||
'offset' => ($page-1)*$limit,
|
'offset' => isset($option['page']) && isset($option['limit']) ? ($option['page'] - 1) * $option['limit'] : 0,
|
||||||
),
|
),
|
||||||
'url' => 'http://music.163.com/api/cloudsearch/pc',
|
'url' => 'http://music.163.com/api/cloudsearch/pc',
|
||||||
),
|
),
|
||||||
|
@ -149,13 +157,13 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'tencent':
|
case 'tencent':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp',
|
'url' => 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
'format' => 'json',
|
'format' => 'json',
|
||||||
'p' => $page,
|
'p' => isset($option['page']) ? $option['page'] : 1,
|
||||||
'n' => $limit,
|
'n' => isset($option['limit']) ? $option['limit'] : 30,
|
||||||
'w' => $keyword,
|
'w' => $keyword,
|
||||||
'aggr' => 1,
|
'aggr' => 1,
|
||||||
'lossless' => 1,
|
'lossless' => 1,
|
||||||
|
@ -166,32 +174,32 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'xiami':
|
case 'xiami':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://api.xiami.com/web',
|
'url' => 'http://api.xiami.com/web',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
'v' => '2.0',
|
'v' => '2.0',
|
||||||
'app_key' => '1',
|
'app_key' => '1',
|
||||||
'key' => $keyword,
|
'key' => $keyword,
|
||||||
'page' => $page,
|
'page' => isset($option['page']) ? $option['page'] : 1,
|
||||||
'limit' => $limit,
|
'limit' => isset($option['limit']) ? $option['limit'] : 30,
|
||||||
'r' => 'search/songs',
|
'r' => 'search/songs',
|
||||||
),
|
),
|
||||||
'format' => 'data#songs',
|
'format' => 'data#songs',
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'kugou':
|
case 'kugou':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://ioscdn.kugou.com/api/v3/search/song',
|
'url' => 'http://ioscdn.kugou.com/api/v3/search/song',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
'iscorrect' => 1,
|
'iscorrect' => 1,
|
||||||
'pagesize' => $limit,
|
'pagesize' => isset($option['limit']) ? $option['limit'] : 30,
|
||||||
'plat' => 2,
|
'plat' => 2,
|
||||||
'tag' => 1,
|
'tag' => 1,
|
||||||
'sver' => 5,
|
'sver' => 5,
|
||||||
'showtype' => 10,
|
'showtype' => 10,
|
||||||
'page' => $page,
|
'page' => isset($option['page']) ? $option['page'] : 1,
|
||||||
'keyword' => $keyword,
|
'keyword' => $keyword,
|
||||||
'version' => 8550
|
'version' => 8550
|
||||||
),
|
),
|
||||||
|
@ -199,16 +207,16 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'baidu':
|
case 'baidu':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://musicapi.qianqian.com/v1/restserver/ting',
|
'url' => 'https://musicapi.qianqian.com/v1/restserver/ting',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
'method' => 'baidu.ting.search.merge',
|
'method' => 'baidu.ting.search.merge',
|
||||||
'isNew' => 1,
|
'isNew' => 1,
|
||||||
'query' => $keyword,
|
'query' => $keyword,
|
||||||
'page_size' => $limit,
|
'page_size' => isset($option['limit']) ? $option['limit'] : 30,
|
||||||
'page_no' => $page,
|
'page_no' => isset($option['page']) ? $option['page'] : 1,
|
||||||
'type' => 0,
|
'type' => isset($option['type']) ? $option['type'] : 0,
|
||||||
'format' => 'json',
|
'format' => 'json',
|
||||||
'from' => 'ios',
|
'from' => 'ios',
|
||||||
'channel' => '(null)',
|
'channel' => '(null)',
|
||||||
|
@ -227,22 +235,22 @@ class Meting
|
||||||
{
|
{
|
||||||
switch ($this->_SITE) {
|
switch ($this->_SITE) {
|
||||||
case 'netease':
|
case 'netease':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'http://music.163.com/api/linux/forward',
|
'url' => 'http://music.163.com/api/linux/forward',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'params' => array(
|
'params' => array(
|
||||||
'c' => '[{"id":'.$id.'}]',
|
'c' => '[{"id":'.$id.',"v":0}]',
|
||||||
),
|
),
|
||||||
'url' => 'http://music.163.com/api/v3/song/detail',
|
'url' => 'http://music.163.com/api/v3/song/detail/',
|
||||||
),
|
),
|
||||||
'encode' => 'netease_AESECB',
|
'encode' => 'netease_AESECB',
|
||||||
'format' => 'songs',
|
'format' => 'songs',
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'tencent':
|
case 'tencent':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_play_single_song.fcg',
|
'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_play_single_song.fcg',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -255,7 +263,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'xiami':
|
case 'xiami':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://api.xiami.com/web',
|
'url' => 'http://api.xiami.com/web',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -268,7 +276,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'kugou':
|
case 'kugou':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'http://m.kugou.com/app/i/getSongInfo.php',
|
'url' => 'http://m.kugou.com/app/i/getSongInfo.php',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -280,7 +288,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'baidu':
|
case 'baidu':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://musicapi.qianqian.com/v1/restserver/ting',
|
'url' => 'https://musicapi.qianqian.com/v1/restserver/ting',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -304,13 +312,18 @@ class Meting
|
||||||
{
|
{
|
||||||
switch ($this->_SITE) {
|
switch ($this->_SITE) {
|
||||||
case 'netease':
|
case 'netease':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'http://music.163.com/api/linux/forward',
|
'url' => 'http://music.163.com/api/linux/forward',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'params' => array(
|
'params' => array(
|
||||||
'id' => $id,
|
"total" => "true",
|
||||||
|
"offset" => "0",
|
||||||
|
"id" => $id,
|
||||||
|
"limit" => "1000",
|
||||||
|
"ext" => "true",
|
||||||
|
"private_cloud" => "true"
|
||||||
),
|
),
|
||||||
'url' => 'http://music.163.com/api/v1/album/'.$id,
|
'url' => 'http://music.163.com/api/v1/album/'.$id,
|
||||||
),
|
),
|
||||||
|
@ -319,7 +332,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'tencent':
|
case 'tencent':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_v8_album_detail_cp.fcg',
|
'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_v8_album_detail_cp.fcg',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -332,7 +345,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'xiami':
|
case 'xiami':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://api.xiami.com/web',
|
'url' => 'http://api.xiami.com/web',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -345,7 +358,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'kugou':
|
case 'kugou':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://mobilecdn.kugou.com/api/v3/album/song',
|
'url' => 'http://mobilecdn.kugou.com/api/v3/album/song',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -359,7 +372,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'baidu':
|
case 'baidu':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://musicapi.qianqian.com/v1/restserver/ting',
|
'url' => 'https://musicapi.qianqian.com/v1/restserver/ting',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -383,15 +396,17 @@ class Meting
|
||||||
{
|
{
|
||||||
switch ($this->_SITE) {
|
switch ($this->_SITE) {
|
||||||
case 'netease':
|
case 'netease':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'http://music.163.com/api/linux/forward',
|
'url' => 'http://music.163.com/api/linux/forward',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'params' => array(
|
'params' => array(
|
||||||
'top' => $limit,
|
|
||||||
"id" => $id,
|
|
||||||
"ext" => "true",
|
"ext" => "true",
|
||||||
|
"private_cloud" => "true",
|
||||||
|
"ext" => "true",
|
||||||
|
"top" => $limit,
|
||||||
|
"id" => $id
|
||||||
),
|
),
|
||||||
'url' => 'http://music.163.com/api/v1/artist/'.$id,
|
'url' => 'http://music.163.com/api/v1/artist/'.$id,
|
||||||
),
|
),
|
||||||
|
@ -400,7 +415,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'tencent':
|
case 'tencent':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_v8_singer_track_cp.fcg',
|
'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_v8_singer_track_cp.fcg',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -415,7 +430,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'xiami':
|
case 'xiami':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://api.xiami.com/web',
|
'url' => 'http://api.xiami.com/web',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -430,7 +445,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'kugou':
|
case 'kugou':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://mobilecdn.kugou.com/api/v3/singer/song',
|
'url' => 'http://mobilecdn.kugou.com/api/v3/singer/song',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -444,7 +459,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'baidu':
|
case 'baidu':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://musicapi.qianqian.com/v1/restserver/ting',
|
'url' => 'https://musicapi.qianqian.com/v1/restserver/ting',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -469,14 +484,16 @@ class Meting
|
||||||
{
|
{
|
||||||
switch ($this->_SITE) {
|
switch ($this->_SITE) {
|
||||||
case 'netease':
|
case 'netease':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'http://music.163.com/api/linux/forward',
|
'url' => 'http://music.163.com/api/linux/forward',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'params' => array(
|
'params' => array(
|
||||||
'id' => $id,
|
"s" => "0",
|
||||||
"n" => 1000,
|
"id" => $id,
|
||||||
|
"n" => "1000",
|
||||||
|
"t" => "0"
|
||||||
),
|
),
|
||||||
'url' => 'http://music.163.com/api/v3/playlist/detail',
|
'url' => 'http://music.163.com/api/v3/playlist/detail',
|
||||||
),
|
),
|
||||||
|
@ -485,7 +502,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'tencent':
|
case 'tencent':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_v8_playlist_cp.fcg',
|
'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_v8_playlist_cp.fcg',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -498,7 +515,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'xiami':
|
case 'xiami':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://api.xiami.com/web',
|
'url' => 'http://api.xiami.com/web',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -511,7 +528,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'kugou':
|
case 'kugou':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://mobilecdn.kugou.com/api/v3/special/song',
|
'url' => 'http://mobilecdn.kugou.com/api/v3/special/song',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -525,7 +542,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'baidu':
|
case 'baidu':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://musicapi.qianqian.com/v1/restserver/ting',
|
'url' => 'https://musicapi.qianqian.com/v1/restserver/ting',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -549,7 +566,7 @@ class Meting
|
||||||
{
|
{
|
||||||
switch ($this->_SITE) {
|
switch ($this->_SITE) {
|
||||||
case 'netease':
|
case 'netease':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'http://music.163.com/api/linux/forward',
|
'url' => 'http://music.163.com/api/linux/forward',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -565,7 +582,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'tencent':
|
case 'tencent':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_play_single_song.fcg',
|
'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_play_single_song.fcg',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -577,7 +594,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'xiami':
|
case 'xiami':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://www.xiami.com/song/gethqsong/sid/'.$id,
|
'url' => 'http://www.xiami.com/song/gethqsong/sid/'.$id,
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -590,7 +607,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'kugou':
|
case 'kugou':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'http://media.store.kugou.com/v1/get_res_privilege',
|
'url' => 'http://media.store.kugou.com/v1/get_res_privilege',
|
||||||
'body' => json_encode(array(
|
'body' => json_encode(array(
|
||||||
|
@ -611,7 +628,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'baidu':
|
case 'baidu':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://music.baidu.com/data/music/fmlink',
|
'url' => 'http://music.baidu.com/data/music/fmlink',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -623,7 +640,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->_TEMP['br']=$br;
|
$this->_TEMP['br'] = $br;
|
||||||
return $this->curl($API);
|
return $this->curl($API);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,7 +648,7 @@ class Meting
|
||||||
{
|
{
|
||||||
switch ($this->_SITE) {
|
switch ($this->_SITE) {
|
||||||
case 'netease':
|
case 'netease':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'http://music.163.com/api/linux/forward',
|
'url' => 'http://music.163.com/api/linux/forward',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -650,7 +667,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'tencent':
|
case 'tencent':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric_new.fcg',
|
'url' => 'https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric_new.fcg',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -661,7 +678,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'xiami':
|
case 'xiami':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://api.xiami.com/web',
|
'url' => 'http://api.xiami.com/web',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -674,7 +691,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'kugou':
|
case 'kugou':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'http://m.kugou.com/app/i/krc.php',
|
'url' => 'http://m.kugou.com/app/i/krc.php',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -687,7 +704,7 @@ class Meting
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'baidu':
|
case 'baidu':
|
||||||
$API=array(
|
$API = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'url' => 'https://musicapi.qianqian.com/v1/restserver/ting',
|
'url' => 'https://musicapi.qianqian.com/v1/restserver/ting',
|
||||||
'body' => array(
|
'body' => array(
|
||||||
|
@ -749,31 +766,31 @@ class Meting
|
||||||
case 'netease':
|
case 'netease':
|
||||||
return array(
|
return array(
|
||||||
'referer' => 'https://music.163.com/',
|
'referer' => 'https://music.163.com/',
|
||||||
'cookie' => 'os=linux; appver=1.0.0.1026; osver=Ubuntu%2016.10; MUSIC_U=' . $this->getRandomHex(112) . '; __remember_me=true',
|
'cookie' => 'os=linux; deviceId=' . $this->getRandomHex(52) . '; osver=Ubuntu%2016.04.3%20LTS; appver=1.1.0.1232; channel=netease; MUSIC_A=' . $this->getRandomHex(208) . '; __csrf=' . $this->getRandomHex(32),
|
||||||
'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
|
'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36',
|
||||||
);
|
);
|
||||||
case 'tencent':
|
case 'tencent':
|
||||||
return array(
|
return array(
|
||||||
'referer' => 'https://y.qq.com/portal/player.html',
|
'referer' => 'https://y.qq.com/portal/player.html',
|
||||||
'cookie' => 'pgv_pvi=22038528; pgv_si=s3156287488; pgv_pvid=5535248600; yplayer_open=1; ts_last=y.qq.com/portal/player.html; ts_uid=4847550686; yq_index=0; qqmusic_fromtag=66; player_exist=1',
|
'cookie' => 'pgv_pvi=22038528; pgv_si=s3156287488; pgv_pvid=5535248600; yplayer_open=1; ts_last=y.qq.com/portal/player.html; ts_uid=4847550686; yq_index=0; qqmusic_fromtag=66; player_exist=1',
|
||||||
'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
|
'useragent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36',
|
||||||
);
|
);
|
||||||
case 'xiami':
|
case 'xiami':
|
||||||
return array(
|
return array(
|
||||||
'referer' => 'http://h.xiami.com/',
|
'referer' => 'http://h.xiami.com/',
|
||||||
'cookie' => 'user_from=2;XMPLAYER_addSongsToggler=0;XMPLAYER_isOpen=0;_xiamitoken=123456789' . $this->getRandomHex(32) . ';',
|
'cookie' => '_xiamitoken=' . $this->getRandomHex(32) . '; _unsign_token=' . $this->getRandomHex(32),
|
||||||
'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
|
'useragent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36',
|
||||||
);
|
);
|
||||||
case 'kugou':
|
case 'kugou':
|
||||||
return array(
|
return array(
|
||||||
'referer' => 'http://www.kugou.com/webkugouplayer/flash/webKugou.swf',
|
'referer' => 'http://www.kugou.com/webkugouplayer/flash/webKugou.swf',
|
||||||
'cookie' => '_WCMID=123456789',
|
'cookie' => 'kg_mid=' . $this->getRandomHex(32),
|
||||||
'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
|
'useragent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36',
|
||||||
);
|
);
|
||||||
case 'baidu':
|
case 'baidu':
|
||||||
return array(
|
return array(
|
||||||
'referer' => 'http://ting.baidu.com/',
|
'referer' => 'http://ting.baidu.com/',
|
||||||
'cookie' => 'BAIDUID=123456789',
|
'cookie' => 'BAIDUID=' . $this->getRandomHex(32),
|
||||||
'useragent' => 'ios_5.9.12',
|
'useragent' => 'ios_5.9.12',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -781,11 +798,11 @@ class Meting
|
||||||
|
|
||||||
private function getRandomHex($length)
|
private function getRandomHex($length)
|
||||||
{
|
{
|
||||||
$val = '';
|
if (function_exists('openssl_random_pseudo_bytes')) {
|
||||||
for( $i=0; $i<$length; $i++ ) {
|
return bin2hex(openssl_random_pseudo_bytes($length));
|
||||||
$val .= chr( rand( 65, 90 ) );
|
} else {
|
||||||
|
return bin2hex(mcrypt_create_iv($length, MCRYPT_DEV_URANDOM));
|
||||||
}
|
}
|
||||||
return $val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue