From 110e2bc1e4e6759ec3e5f3323d23bf816fc71e4f Mon Sep 17 00:00:00 2001 From: and0rW Date: Fri, 31 Mar 2017 11:10:09 +0800 Subject: [PATCH 1/7] post try sodo --- index.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 index.php diff --git a/index.php b/index.php new file mode 100644 index 0000000..084f045 --- /dev/null +++ b/index.php @@ -0,0 +1,14 @@ +// If you installed via composer, just use this code to requrie autoloader on the top of your projects. +require 'vendor/autoload.php'; + +// Else use require file +// require 'Meting.php'; + +// Initialize to netease API +$API = new Meting('netease'); + +// Enjoy +$result = $API->format(true)->search('Soldier'); +$data = json_decode($result); +header('Content-type: application/json; charset=UTF-8'); +echo json_encode($data,JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES); From cc9f3508c543a0a1db428693e59a0441ab6b2cfa Mon Sep 17 00:00:00 2001 From: and0rW Date: Fri, 31 Mar 2017 12:09:45 +0800 Subject: [PATCH 2/7] fix netease fix netease --- Meting.php | 16 +++++++-- README.md | 98 ++++++++++++++++++++++++++++++------------------------ 2 files changed, 67 insertions(+), 47 deletions(-) diff --git a/Meting.php b/Meting.php index 323a925..9ac99a6 100644 --- a/Meting.php +++ b/Meting.php @@ -811,10 +811,18 @@ class Meting private function netease_url($result) { $data=json_decode($result, 1); - $url=array( - 'url' => str_replace('http:', 'https:', $data['data'][0]['url']), - 'br' => $data['data'][0]['br']/1000, + if($data['data'][0]['uf'] != null){ + $url=array( + 'url' => str_replace('http:', 'https:', $data['data'][0]['uf']['url']), + 'br' =>$data['data'][0]['uf']['type'], ); + } + else{ + $url=array( + 'url' => str_replace('http:', 'https:', $data['data'][0]['url']), + 'br' => $data['data'][0]['br']/1000, + ); + } return json_encode($url); } private function tencent_url($result) @@ -978,6 +986,8 @@ class Meting 'url_id' => $data['id'], 'lyric_id' => $data['id'], 'source' => 'netease', + 'maxbr' => $data['privilege']['maxbr'], + 'al_name' => $data['al']['name'], ); if (isset($data['al']['picUrl'])) { preg_match('/\/(\d+)\./', $data['al']['picUrl'], $match); diff --git a/README.md b/README.md index 6961214..692efa9 100644 --- a/README.md +++ b/README.md @@ -1,59 +1,69 @@ -![](http://ww2.sinaimg.cn/large/a15b4afegw1fbg1l7wn09j20fw05gq34) -## Meting -[![Latest Stable Version](https://poser.pugx.org/metowolf/Meting/v/stable)](https://packagist.org/packages/metowolf/Meting) -[![License](https://poser.pugx.org/metowolf/Meting/license)](https://packagist.org/packages/metowolf/Meting) +##改动说明 ++ 扩展封装 ++ 修复网易云音乐的ape解析 - > :lollipop:Wow, such a powerful music API framework +## 以下为原版介绍 -## Introduction -A powerful music API framework to accelerate development - + **Easy** - Easy to use, suppose format return. - + **Light** - 38KB around with only one file. - + **Powerful** - Suppose various webserver, include netease, tencent, xiami, kugou, baidu, kuwo and more. - + **Free** - Under MIT license, you can use it anywhere if you want. +>![](http://ww2.sinaimg.cn/large/a15b4afegw1fbg1l7wn09j20fw05gq34) +>## Meting +>[![Latest Stable Version](https://poser.pugx.org/metowolf/Meting/v/stable)](https://packagist.org/packages/metowolf/Meting) +>[![License](https://poser.pugx.org/metowolf/Meting/license)](https://packagist.org/packages/metowolf/Meting) -## Requirement -PHP 5.3+ and Curl extension installed +> > :lollipop:Wow, such a powerful music API framework -## Get Started +>## Introduction +>A powerful music API framework to accelerate development -### Install via composer -Add Meting to composer.json configuration file. -``` -$ composer require metowolf/meting -``` -And update the composer -``` -$ composer update -``` +>+ **Easy** - Easy to use, suppose format return. +>+ **Light** - 38KB around with only one file. +>+ **Powerful** - Suppose various webserver, include netease, tencent, xiami, kugou, baidu, >kuwo and more. +>+ **Free** - Under MIT license, you can use it anywhere if you want. -### Install via require -```php -// If you installed via composer, just use this code to requrie autoloader on the top of your projects. -require 'vendor/autoload.php'; +>## Requirement +>PHP 5.3+ and Curl extension installed -// Else use require file -// require 'Meting.php'; +>## Get Started -// Initialize to netease API -$API = new Meting('netease'); +>### Install via composer +>Add Meting to composer.json configuration file. +>``` +>$ composer require metowolf/meting +>``` +>And update the composer +>``` +>$ composer update +>``` -// Enjoy -$data = $API->format(true)->search('Soldier'); -``` +>### Install via require +>```php +>// If you installed via composer, just use this code to requrie autoloader on the top of your projects. +>require 'vendor/autoload.php'; -## More usage -[wiki/docs](https://github.com/metowolf/Meting/wiki) -## Related Projects - - [Hermit-X (Wordpress)](https://github.com/liwanglin12/Hermit-X) - - [Meting for Typecho](https://github.com/metowolf/Meting-Typecho-Plugin) +>// Else use require file +>// require 'Meting.php'; -## License -Meting is under the MIT license. +>// Initialize to netease API +>$API = new Meting('netease'); -## Links -Official website: https://i-meto.com -Demo: https://music.i-meto.com +>// Enjoy +>$data = $API->format(true)->search('Soldier'); +>``` +> + + +>## More usage +>[wiki/docs](https://github.com/metowolf/Meting/wiki) + +>## Related Projects +>- [Hermit-X (Wordpress)](https://github.com/liwanglin12/Hermit-X) +>- [Meting for Typecho](https://github.com/metowolf/Meting-Typecho-Plugin) + +>## License +>Meting is under the MIT license. + +>## Links +>Official website: https://i-meto.com +>Demo: https://music.i-meto.com From 02a149f05512b25505fed4da99552a0a683cc643 Mon Sep 17 00:00:00 2001 From: and0rW Date: Fri, 31 Mar 2017 12:17:34 +0800 Subject: [PATCH 3/7] Revert "fix netease" This reverts commit cc9f3508c543a0a1db428693e59a0441ab6b2cfa. --- Meting.php | 16 ++------- README.md | 98 ++++++++++++++++++++++++------------------------------ 2 files changed, 47 insertions(+), 67 deletions(-) diff --git a/Meting.php b/Meting.php index 9ac99a6..323a925 100644 --- a/Meting.php +++ b/Meting.php @@ -811,18 +811,10 @@ class Meting private function netease_url($result) { $data=json_decode($result, 1); - if($data['data'][0]['uf'] != null){ - $url=array( - 'url' => str_replace('http:', 'https:', $data['data'][0]['uf']['url']), - 'br' =>$data['data'][0]['uf']['type'], + $url=array( + 'url' => str_replace('http:', 'https:', $data['data'][0]['url']), + 'br' => $data['data'][0]['br']/1000, ); - } - else{ - $url=array( - 'url' => str_replace('http:', 'https:', $data['data'][0]['url']), - 'br' => $data['data'][0]['br']/1000, - ); - } return json_encode($url); } private function tencent_url($result) @@ -986,8 +978,6 @@ class Meting 'url_id' => $data['id'], 'lyric_id' => $data['id'], 'source' => 'netease', - 'maxbr' => $data['privilege']['maxbr'], - 'al_name' => $data['al']['name'], ); if (isset($data['al']['picUrl'])) { preg_match('/\/(\d+)\./', $data['al']['picUrl'], $match); diff --git a/README.md b/README.md index 692efa9..6961214 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,59 @@ +![](http://ww2.sinaimg.cn/large/a15b4afegw1fbg1l7wn09j20fw05gq34) -##改动说明 -+ 扩展封装 -+ 修复网易云音乐的ape解析 +## Meting +[![Latest Stable Version](https://poser.pugx.org/metowolf/Meting/v/stable)](https://packagist.org/packages/metowolf/Meting) +[![License](https://poser.pugx.org/metowolf/Meting/license)](https://packagist.org/packages/metowolf/Meting) -## 以下为原版介绍 + > :lollipop:Wow, such a powerful music API framework +## Introduction +A powerful music API framework to accelerate development ->![](http://ww2.sinaimg.cn/large/a15b4afegw1fbg1l7wn09j20fw05gq34) ->## Meting ->[![Latest Stable Version](https://poser.pugx.org/metowolf/Meting/v/stable)](https://packagist.org/packages/metowolf/Meting) ->[![License](https://poser.pugx.org/metowolf/Meting/license)](https://packagist.org/packages/metowolf/Meting) + + **Easy** - Easy to use, suppose format return. + + **Light** - 38KB around with only one file. + + **Powerful** - Suppose various webserver, include netease, tencent, xiami, kugou, baidu, kuwo and more. + + **Free** - Under MIT license, you can use it anywhere if you want. -> > :lollipop:Wow, such a powerful music API framework +## Requirement +PHP 5.3+ and Curl extension installed ->## Introduction ->A powerful music API framework to accelerate development +## Get Started ->+ **Easy** - Easy to use, suppose format return. ->+ **Light** - 38KB around with only one file. ->+ **Powerful** - Suppose various webserver, include netease, tencent, xiami, kugou, baidu, >kuwo and more. ->+ **Free** - Under MIT license, you can use it anywhere if you want. +### Install via composer +Add Meting to composer.json configuration file. +``` +$ composer require metowolf/meting +``` +And update the composer +``` +$ composer update +``` ->## Requirement ->PHP 5.3+ and Curl extension installed +### Install via require +```php +// If you installed via composer, just use this code to requrie autoloader on the top of your projects. +require 'vendor/autoload.php'; ->## Get Started +// Else use require file +// require 'Meting.php'; ->### Install via composer ->Add Meting to composer.json configuration file. ->``` ->$ composer require metowolf/meting ->``` ->And update the composer ->``` ->$ composer update ->``` +// Initialize to netease API +$API = new Meting('netease'); ->### Install via require ->```php ->// If you installed via composer, just use this code to requrie autoloader on the top of your projects. ->require 'vendor/autoload.php'; +// Enjoy +$data = $API->format(true)->search('Soldier'); +``` +## More usage +[wiki/docs](https://github.com/metowolf/Meting/wiki) ->// Else use require file ->// require 'Meting.php'; +## Related Projects + - [Hermit-X (Wordpress)](https://github.com/liwanglin12/Hermit-X) + - [Meting for Typecho](https://github.com/metowolf/Meting-Typecho-Plugin) ->// Initialize to netease API ->$API = new Meting('netease'); +## License +Meting is under the MIT license. ->// Enjoy ->$data = $API->format(true)->search('Soldier'); ->``` -> - - ->## More usage ->[wiki/docs](https://github.com/metowolf/Meting/wiki) - ->## Related Projects ->- [Hermit-X (Wordpress)](https://github.com/liwanglin12/Hermit-X) ->- [Meting for Typecho](https://github.com/metowolf/Meting-Typecho-Plugin) - ->## License ->Meting is under the MIT license. - ->## Links ->Official website: https://i-meto.com ->Demo: https://music.i-meto.com +## Links +Official website: https://i-meto.com +Demo: https://music.i-meto.com From 9726500d4fa21a101fc1f6b8509b2a11014e3399 Mon Sep 17 00:00:00 2001 From: and0rW Date: Fri, 31 Mar 2017 13:38:59 +0800 Subject: [PATCH 4/7] add todo add todo --- Meting.php | 18 +++++++-- README.md | 106 +++++++++++++++++++++++++++++++---------------------- 2 files changed, 76 insertions(+), 48 deletions(-) diff --git a/Meting.php b/Meting.php index 323a925..8d097b4 100644 --- a/Meting.php +++ b/Meting.php @@ -78,7 +78,7 @@ class Meting 'status' => $status, )); } - if (isset($API['decode'])) { + if ($this->_FORMAT&&isset($API['decode'])) { $data=call_user_func_array(array($this,$API['decode']), array($data)); } if ($this->_FORMAT&&isset($API['format'])) { @@ -811,10 +811,18 @@ class Meting private function netease_url($result) { $data=json_decode($result, 1); - $url=array( - 'url' => str_replace('http:', 'https:', $data['data'][0]['url']), - 'br' => $data['data'][0]['br']/1000, + if($data['data'][0]['uf'] != null){ + $url=array( + 'url' => str_replace('http:', 'https:', $data['data'][0]['uf']['url']), + 'br' =>$data['data'][0]['uf']['type'], ); + } + else{ + $url=array( + 'url' => str_replace('http:', 'https:', $data['data'][0]['url']), + 'br' => $data['data'][0]['br']/1000, + ); + } return json_encode($url); } private function tencent_url($result) @@ -978,6 +986,8 @@ class Meting 'url_id' => $data['id'], 'lyric_id' => $data['id'], 'source' => 'netease', + 'maxbr' => $data['privilege']['maxbr'], + 'al_name' => $data['al']['name'], ); if (isset($data['al']['picUrl'])) { preg_match('/\/(\d+)\./', $data['al']['picUrl'], $match); diff --git a/README.md b/README.md index 6961214..5d69362 100644 --- a/README.md +++ b/README.md @@ -1,59 +1,77 @@ -![](http://ww2.sinaimg.cn/large/a15b4afegw1fbg1l7wn09j20fw05gq34) -## Meting -[![Latest Stable Version](https://poser.pugx.org/metowolf/Meting/v/stable)](https://packagist.org/packages/metowolf/Meting) -[![License](https://poser.pugx.org/metowolf/Meting/license)](https://packagist.org/packages/metowolf/Meting) +##改动说明 ++ url解析的无封装支持 ++ 扩展网易云封装 ++ 修复网易云音乐的ape解析 - > :lollipop:Wow, such a powerful music API framework +##TODO ++ 无损格式更宽泛的支持 ++ 统一的封装结构 ++ 虾米音乐320K支持 ++ 腾讯音乐无损支持 ++ 优化大量请求 -## Introduction -A powerful music API framework to accelerate development +## 以下为原版介绍 - + **Easy** - Easy to use, suppose format return. - + **Light** - 38KB around with only one file. - + **Powerful** - Suppose various webserver, include netease, tencent, xiami, kugou, baidu, kuwo and more. - + **Free** - Under MIT license, you can use it anywhere if you want. -## Requirement -PHP 5.3+ and Curl extension installed +>![](http://ww2.sinaimg.cn/large/a15b4afegw1fbg1l7wn09j20fw05gq34) +>## Meting +>[![Latest Stable Version](https://poser.pugx.org/metowolf/Meting/v/stable)](https://packagist.org/packages/metowolf/Meting) +>[![License](https://poser.pugx.org/metowolf/Meting/license)](https://packagist.org/packages/metowolf/Meting) -## Get Started +> > :lollipop:Wow, such a powerful music API framework -### Install via composer -Add Meting to composer.json configuration file. -``` -$ composer require metowolf/meting -``` -And update the composer -``` -$ composer update -``` +>## Introduction +>A powerful music API framework to accelerate development -### Install via require -```php -// If you installed via composer, just use this code to requrie autoloader on the top of your projects. -require 'vendor/autoload.php'; +>+ **Easy** - Easy to use, suppose format return. +>+ **Light** - 38KB around with only one file. +>+ **Powerful** - Suppose various webserver, include netease, tencent, xiami, kugou, baidu, >kuwo and more. +>+ **Free** - Under MIT license, you can use it anywhere if you want. -// Else use require file -// require 'Meting.php'; +>## Requirement +>PHP 5.3+ and Curl extension installed -// Initialize to netease API -$API = new Meting('netease'); +>## Get Started -// Enjoy -$data = $API->format(true)->search('Soldier'); -``` +>### Install via composer +>Add Meting to composer.json configuration file. +>``` +>$ composer require metowolf/meting +>``` +>And update the composer +>``` +>$ composer update +>``` -## More usage -[wiki/docs](https://github.com/metowolf/Meting/wiki) +>### Install via require +>```php +>// If you installed via composer, just use this code to requrie autoloader on the top of your projects. +>require 'vendor/autoload.php'; -## Related Projects - - [Hermit-X (Wordpress)](https://github.com/liwanglin12/Hermit-X) - - [Meting for Typecho](https://github.com/metowolf/Meting-Typecho-Plugin) -## License -Meting is under the MIT license. +>// Else use require file +>// require 'Meting.php'; -## Links -Official website: https://i-meto.com -Demo: https://music.i-meto.com +>// Initialize to netease API +>$API = new Meting('netease'); + +>// Enjoy +>$data = $API->format(true)->search('Soldier'); +>``` +> + + +>## More usage +>[wiki/docs](https://github.com/metowolf/Meting/wiki) + +>## Related Projects +>- [Hermit-X (Wordpress)](https://github.com/liwanglin12/Hermit-X) +>- [Meting for Typecho](https://github.com/metowolf/Meting-Typecho-Plugin) + +>## License +>Meting is under the MIT license. + +>## Links +>Official website: https://i-meto.com +>Demo: https://music.i-meto.com From 589dd0dd3269eeb2e1358346fd68a8765e1e59e1 Mon Sep 17 00:00:00 2001 From: and0rW Date: Fri, 31 Mar 2017 13:41:14 +0800 Subject: [PATCH 5/7] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5d69362..6eb9d09 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -##改动说明 +## 改动说明 + url解析的无封装支持 + 扩展网易云封装 + 修复网易云音乐的ape解析 -##TODO +## TODO + 无损格式更宽泛的支持 + 统一的封装结构 + 虾米音乐320K支持 From 6e8875582924a3d4b4a51e0165fd54f56f6d84d9 Mon Sep 17 00:00:00 2001 From: and0rW Date: Wed, 5 Apr 2017 15:57:18 +0800 Subject: [PATCH 6/7] add xiami-320k add xiami-320k --- Meting.php | 37 ++++++++++++++++++++++++++++++++++--- README.md | 5 ++++- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Meting.php b/Meting.php index 8d097b4..5ab4a6e 100644 --- a/Meting.php +++ b/Meting.php @@ -557,7 +557,7 @@ class Meting case 'xiami': $API=array( 'method' => 'GET', - 'url' => 'http://api.xiami.com/web', + 'url' => 'http://www.xiami.com/song/gethqsong/sid/'.$id, 'body' => array( 'v' => '2.0', 'app_key' => '1', @@ -860,10 +860,41 @@ class Meting private function xiami_url($result) { $data=json_decode($result, 1); + if(isset($data['location'])){ + $location = $data['location']; + $num = (int)$location[0]; + $str = substr($location,1); + $len = floor(strlen($str)/$num); + $sub = strlen($str) % $num; + $qrc = array(); + $tmp = 0; + $urlt = ''; + for(;$tmp<$sub;$tmp++){ + $qrc[$tmp] = substr($str,$tmp*($len+1),$len+1); + } + for(;$tmp<$num;$tmp++){ + $qrc[$tmp] = substr($str,$len*$tmp+$sub,$len); + } + for($tmpa=0;$tmpa<$len+1;$tmpa++){ + for($tmpb=0;$tmpb<$num;$tmpb++){ + if(isset($qrc[$tmpb][$tmpa])) $urlt.=$qrc[$tmpb][$tmpa]; + } + } + for($tmp=0;$tmp<$sub;$tmp++){ + //if(isset($qrc[$tmp][$len])) (string)$urlt.=(string)$qrc[$tmp][$len]; + } + $urlt=str_replace('^','0',urldecode($urlt)); + $url=array( + 'url' => urldecode($urlt), + 'br' => 320, + ); + } + else{ $url=array( - 'url' => str_replace('http:', 'https:', $data['data']['song']['listen_file']), - 'br' => 128, + 'url' => "error",//str_replace('http:', 'https:', $data['data']['song']['listen_file']), + 'br' => 0, ); + } return json_encode($url); } private function kugou_url($result) diff --git a/README.md b/README.md index 6eb9d09..6ae02c6 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,12 @@ + url解析的无封装支持 + 扩展网易云封装 + 修复网易云音乐的ape解析 ++ 支持虾米音乐320k解析 ## TODO + 无损格式更宽泛的支持 + 统一的封装结构 -+ 虾米音乐320K支持 ++ ~~虾米音乐320K支持~~ + 腾讯音乐无损支持 + 优化大量请求 @@ -48,6 +49,7 @@ >```php >// If you installed via composer, just use this code to requrie autoloader on the top of your projects. >require 'vendor/autoload.php'; +>``` >// Else use require file @@ -60,6 +62,7 @@ >$data = $API->format(true)->search('Soldier'); >``` > +>``` >## More usage From b3b7aa4587eca18e29c2ed619b000fbbd1571100 Mon Sep 17 00:00:00 2001 From: and0rW Date: Wed, 5 Apr 2017 17:36:58 +0800 Subject: [PATCH 7/7] add tencent-ape add tencent-ape --- Meting.php | 4 +++- README.md | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Meting.php b/Meting.php index 5ab4a6e..7e8edba 100644 --- a/Meting.php +++ b/Meting.php @@ -841,6 +841,8 @@ class Meting $KEY=json_decode($this->curl($API), 1)['key']; $type=array( + 'size_ape' =>array(999,'A000','ape',true), + 'size_flac' =>array(998,'F000','flac',true), 'size_320mp3'=>array(320,'M800','mp3'), 'size_128mp3'=>array(128,'M500','mp3'), 'size_96aac'=>array(96,'C400','m4a'), @@ -849,7 +851,7 @@ class Meting foreach ($type as $key=>$vo) { if ($data['data'][0]['file'][$key]&&$vo[0]<=$this->_temp['br']) { $url=array( - 'url' => 'http://dl.stream.qqmusic.qq.com/'.$vo[1].$data['data'][0]['file']['media_mid'].'.'.$vo[2].'?vkey='.$KEY.'&guid='.$GUID.'&uid=0&fromtag=30', + 'url' => isset($vo[3])? 'http://stream.qqmusic.tc.qq.com/'.$vo[1].$data['data'][0]['file']['media_mid'].'.'.$vo[2]:'http://dl.stream.qqmusic.qq.com/'.$vo[1].$data['data'][0]['file']['media_mid'].'.'.$vo[2].'?vkey='.$KEY.'&guid='.$GUID.'&uid=0&fromtag=30', 'br' => $vo[0], ); break; diff --git a/README.md b/README.md index 6ae02c6..9c57489 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,13 @@ + 扩展网易云封装 + 修复网易云音乐的ape解析 + 支持虾米音乐320k解析 ++ 腾讯音乐无损支持 ## TODO + 无损格式更宽泛的支持 + 统一的封装结构 + ~~虾米音乐320K支持~~ -+ 腾讯音乐无损支持 ++ ~~腾讯音乐无损支持~~ + 优化大量请求 ## 以下为原版介绍