Changeset 1796335
- Timestamp:
- 01/03/2018 11:12:04 AM (8 years ago)
- Location:
- netease-music/trunk
- Files:
-
- 3 edited
-
functions/Meting.php (modified) (33 diffs)
-
neteasemusic.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
netease-music/trunk/functions/Meting.php
r1775196 r1796335 4 4 * https://i-meto.com 5 5 * https://github.com/metowolf/Meting 6 * Version 1.3. 6.16 * Version 1.3.10 7 7 * 8 8 * Copyright 2017, METO Sheel <[email protected]> 9 9 * Released under the MIT license 10 10 */ 11 11 12 namespace Metowolf; 13 12 14 class Meting 13 15 { … … 16 18 protected $_RETRY = 3; 17 19 protected $_FORMAT = false; 20 18 21 public function __construct($v = 'netease') 19 22 { 20 23 $this->site($v); 21 24 } 25 22 26 public function site($v) 23 27 { … … 26 30 return $this; 27 31 } 32 28 33 public function cookie($v = '') 29 34 { … … 32 37 } 33 38 } 39 34 40 public function format($v = true) 35 41 { … … 37 43 return $this; 38 44 } 45 39 46 private function curl($API) 40 47 { … … 95 102 return $data; 96 103 } 104 97 105 private function pickup($array, $rule) 98 106 { 99 107 $t=explode('#', $rule); 100 108 foreach ($t as $vo) { 101 if ( is_null($array)){109 if (!isset($array[$vo])){ 102 110 return array(); 103 111 } … … 106 114 return $array; 107 115 } 116 108 117 private function clean($raw, $rule) 109 118 { … … 117 126 return $result; 118 127 } 128 119 129 public function search($keyword, $page=1, $limit=30) 120 130 { … … 131 141 'limit' => $limit, 132 142 'total' => 'true', 133 'offset' => $page-1,143 'offset' => ($page-1)*$limit, 134 144 ), 135 145 'url' => 'http://music.163.com/api/cloudsearch/pc', … … 142 152 $API=array( 143 153 'method' => 'GET', 144 'url' => 'https://c.y.qq.com/soso/fcgi-bin/search_cp', 145 'body' => array( 154 'url' => 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp', 155 'body' => array( 156 'format' => 'json', 146 157 'p' => $page, 147 158 'n' => $limit, … … 150 161 'lossless' => 1, 151 162 'cr' => 1, 152 ),153 'decode' => 'jsonp2json',163 'new_json' => 1, 164 ), 154 165 'format' => 'data#song#list', 155 166 ); … … 212 223 return $this->curl($API); 213 224 } 225 214 226 public function song($id) 215 227 { … … 235 247 'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_play_single_song.fcg', 236 248 'body' => array( 237 'songmid' => $id, 238 'format' => 'json', 249 'songmid' => $id, 250 'platform' => 'yqq', 251 'format' => 'json', 239 252 ), 240 253 'decode' => 'tencent_singlesong', … … 258 271 $API=array( 259 272 'method' => 'POST', 260 'url' => 'http://m.kugou.com/app/i/getSongInfo.php ?',273 'url' => 'http://m.kugou.com/app/i/getSongInfo.php', 261 274 'body' => array( 262 275 "cmd" => "playInfo", … … 287 300 return $this->curl($API); 288 301 } 302 289 303 public function album($id) 290 304 { … … 308 322 $API=array( 309 323 'method' => 'GET', 310 'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_v8_album_ info_cp.fcg',324 'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_v8_album_detail_cp.fcg', 311 325 'body' => array( 312 326 'albummid' => $id, 313 ), 314 'format' => 'data#list', 327 'platform' => 'mac', 328 'format' => 'json', 329 'newsong' => 1, 330 ), 331 'format' => 'data#getSongInfo', 315 332 ); 316 333 break; … … 362 379 return $this->curl($API); 363 380 } 381 364 382 public function artist($id, $limit=50) 365 383 { … … 390 408 'begin' => 0, 391 409 'num' => $limit, 410 'order' => 'listen', 411 'platform' => 'mac', 412 'newsong' => 1, 392 413 ), 393 414 'format' => 'data#list', … … 444 465 return $this->curl($API); 445 466 } 467 446 468 public function playlist($id) 447 469 { … … 466 488 $API=array( 467 489 'method' => 'GET', 468 'url' => 'https://c.y.qq.com/ qzone/fcg-bin/fcg_ucc_getcdinfo_byids_cp.fcg',469 'body' => array( 470 ' disstid'=> $id,471 ' utf8' => 1,472 ' type'=> 1,473 ),474 'decode' => 'jsonp2json',475 'format' => ' cdlist#0#songlist',490 'url' => 'https://c.y.qq.com/v8/fcg-bin/fcg_v8_playlist_cp.fcg', 491 'body' => array( 492 'id' => $id, 493 'format' => 'json', 494 'newsong' => 1, 495 'platform' => 'jqspaframe.json', 496 ), 497 'format' => 'data#cdlist#0#songlist', 476 498 ); 477 499 break; … … 523 545 return $this->curl($API); 524 546 } 547 525 548 public function url($id, $br=320) 526 549 { … … 548 571 'body' => array( 549 572 'songmid' => $id, 573 'platform' => 'yqq', 550 574 'format' => 'json', 551 575 ), … … 603 627 return $this->curl($API); 604 628 } 629 605 630 public function lyric($id) 606 631 { … … 631 656 'body' => array( 632 657 'songmid' => $id, 633 'g_tk' => 5381,658 'g_tk' => '5381', 634 659 ), 635 660 'decode' => 'tencent_lyric', … … 682 707 return $this->curl($API); 683 708 } 709 684 710 public function pic($id, $size=300) 685 711 { … … 717 743 return json_encode(array('url'=>$url)); 718 744 } 745 719 746 private function curlset() 720 747 { 721 $BASE=array( 722 'netease'=>array( 723 'referer' => 'https://music.163.com/', 724 'cookie' => 'os=linux; appver=1.0.0.1026; osver=Ubuntu%2016.10; MUSIC_U=78d411095f4b022667bc8ec49e9a44cca088df057d987f5feaf066d37458e41c4a7d9447977352cf27ea9fee03f6ec4441049cea1c6bb9b6; __remember_me=true', 725 'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 726 ), 727 'tencent'=>array( 728 'referer' => 'http://y.qq.com/portal/player.html', 729 'cookie' => 'qqmusic_uin=12345678; qqmusic_key=12345678; qqmusic_fromtag=30; ts_last=y.qq.com/portal/player.html;', 730 'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 731 ), 732 'xiami'=>array( 733 'referer' => 'http://h.xiami.com/', 734 'cookie' => 'user_from=2;XMPLAYER_addSongsToggler=0;XMPLAYER_isOpen=0;_xiamitoken=123456789;', 735 'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 736 ), 737 'kugou'=>array( 738 'referer' => 'http://www.kugou.com/webkugouplayer/flash/webKugou.swf', 739 'cookie' => '_WCMID=123456789', 740 'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 741 ), 742 'baidu'=>array( 743 'referer' => 'http://ting.baidu.com/', 744 'cookie' => 'BAIDUID=123456789', 745 'useragent' => 'ios_5.9.12', 746 ), 747 ); 748 return $BASE[$this->_SITE]; 749 } 748 switch ($this->_SITE) { 749 case 'netease': 750 return array( 751 'referer' => 'https://music.163.com/', 752 'cookie' => 'os=linux; appver=1.0.0.1026; osver=Ubuntu%2016.10; MUSIC_U=' . $this->getRandomHex(112) . '; __remember_me=true', 753 'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 754 ); 755 case 'tencent': 756 return array( 757 'referer' => 'https://y.qq.com/portal/player.html', 758 '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', 759 'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 760 ); 761 case 'xiami': 762 return array( 763 'referer' => 'http://h.xiami.com/', 764 'cookie' => 'user_from=2;XMPLAYER_addSongsToggler=0;XMPLAYER_isOpen=0;_xiamitoken=123456789' . $this->getRandomHex(32) . ';', 765 'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 766 ); 767 case 'kugou': 768 return array( 769 'referer' => 'http://www.kugou.com/webkugouplayer/flash/webKugou.swf', 770 'cookie' => '_WCMID=123456789', 771 'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 772 ); 773 case 'baidu': 774 return array( 775 'referer' => 'http://ting.baidu.com/', 776 'cookie' => 'BAIDUID=123456789', 777 'useragent' => 'ios_5.9.12', 778 ); 779 } 780 } 781 782 private function getRandomHex($length) 783 { 784 $val = ''; 785 for( $i=0; $i<$length; $i++ ) { 786 $val .= chr( rand( 65, 90 ) ); 787 } 788 return $val; 789 } 790 750 791 /** 751 792 * 乱七八糟的函数,加密解密... … … 763 804 } 764 805 $body=strtoupper(bin2hex(base64_decode($body))); 806 765 807 $API['body']=array( 766 808 'eparams'=>$body, 767 809 ); 768 810 return $API; 769 }770 private function jsonp2json($jsonp)771 {772 if ($jsonp[0] !== '[' && $jsonp[0] !== '{') {773 $jsonp = substr($jsonp, strpos($jsonp, '('));774 }775 return trim($jsonp, '();');776 811 } 777 812 private function tencent_singlesong($result) … … 808 843 $data=json_decode($result, 1); 809 844 if (isset($data['data'][0]['uf']['url'])) { 810 $url=array( 811 'url' => $data['data'][0]['uf']['url'], 812 'br' =>$data['data'][0]['uf']['br']/1000, 813 ); 814 } elseif (isset($data['data'][0]['url'])) { 845 $data['data'][0]['url']=$data['data'][0]['uf']['url']; 846 } 847 if (isset($data['data'][0]['url'])) { 815 848 $url=array( 816 849 'url' => $data['data'][0]['url'], … … 833 866 'url' => 'https://c.y.qq.com/base/fcgi-bin/fcg_musicexpress.fcg', 834 867 'body' => array( 835 'json' => 3, 836 'guid' => $GUID, 868 'json' => 3, 869 'guid' => $GUID, 870 'format' => 'json', 837 871 ), 838 'decode' => 'jsonp2json',839 872 ); 840 873 $KEY=json_decode($this->curl($API), 1); 841 874 $KEY=$KEY['key']; 875 842 876 $type=array( 843 877 'size_320mp3' => array(320,'M800','mp3'), 878 'size_192aac' => array(192,'C600','m4a'), 844 879 'size_128mp3' => array(128,'M500','mp3'), 845 880 'size_96aac' => array(96 ,'C400','m4a'), … … 890 925 $urlt=str_replace('^', '0', urldecode($urlt)); 891 926 $url=array( 892 'url' => str_replace('http://','https://',urldecode($urlt)),893 'br' => 320,927 'url' => str_replace('http://','https://',urldecode($urlt)), 928 'br' => 320, 894 929 ); 895 930 } else { … … 904 939 { 905 940 $data=json_decode($result, 1); 941 906 942 $max=0; 907 943 $url=array(); … … 973 1009 private function tencent_lyric($result) 974 1010 { 975 $result= $this->jsonp2json($result);1011 $result=substr($result,18,-1); 976 1012 if (!$this->_FORMAT) { 977 1013 return $result; … … 1069 1105 } 1070 1106 $result=array( 1071 'id' => $data[' songmid'],1072 'name' => $data[' songname'],1107 'id' => $data['mid'], 1108 'name' => $data['name'], 1073 1109 'artist' => array(), 1074 'album' => isset($data['albumname'])?$data['albumname']:$data['album']['name'],1075 'pic_id' => $data['album mid'],1076 'url_id' => $data[' songmid'],1077 'lyric_id' => $data[' songmid'],1110 'album' => trim($data['album']['title']), 1111 'pic_id' => $data['album']['mid'], 1112 'url_id' => $data['mid'], 1113 'lyric_id' => $data['mid'], 1078 1114 'source' => 'tencent', 1079 1115 ); -
netease-music/trunk/neteasemusic.php
r1775392 r1796335 4 4 Plugin URI: https://fatesinger.com/74369 5 5 Description: WordPress 音乐播放器,支持网易云音乐和虾米音乐。 6 Version: 3.0. 76 Version: 3.0.8 7 7 Author: bigfa 8 8 Author URI: https://fatesinger.com/ 9 9 */ 10 10 11 define('NM_VERSION', '3.0. 7');11 define('NM_VERSION', '3.0.8'); 12 12 define('NM_URL', plugins_url('', __FILE__)); 13 13 define('NM_PATH', dirname( __FILE__ )); -
netease-music/trunk/readme.txt
r1775392 r1796335 31 31 32 32 == Changelog == 33 = 3.0.8 = 34 * 错误修复与样式改进 35 33 36 = 3.0.7 = 34 37 * 如果当前歌曲无法播放则自动切换下一曲
Note: See TracChangeset
for help on using the changeset viewer.