Plugin Directory

Changeset 1796335


Ignore:
Timestamp:
01/03/2018 11:12:04 AM (8 years ago)
Author:
fatesinger
Message:

3.0.8

Location:
netease-music/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • netease-music/trunk/functions/Meting.php

    r1775196 r1796335  
    44 * https://i-meto.com
    55 * https://github.com/metowolf/Meting
    6  * Version 1.3.6.1
     6 * Version 1.3.10
    77 *
    88 * Copyright 2017, METO Sheel <[email protected]>
    99 * Released under the MIT license
    1010 */
     11
    1112namespace Metowolf;
     13
    1214class Meting
    1315{
     
    1618    protected $_RETRY = 3;
    1719    protected $_FORMAT = false;
     20
    1821    public function __construct($v = 'netease')
    1922    {
    2023        $this->site($v);
    2124    }
     25
    2226    public function site($v)
    2327    {
     
    2630        return $this;
    2731    }
     32
    2833    public function cookie($v = '')
    2934    {
     
    3237        }
    3338    }
     39
    3440    public function format($v = true)
    3541    {
     
    3743        return $this;
    3844    }
     45
    3946    private function curl($API)
    4047    {
     
    95102        return $data;
    96103    }
     104
    97105    private function pickup($array, $rule)
    98106    {
    99107        $t=explode('#', $rule);
    100108        foreach ($t as $vo) {
    101             if (is_null($array)) {
     109            if (!isset($array[$vo])){
    102110                return array();
    103111            }
     
    106114        return $array;
    107115    }
     116
    108117    private function clean($raw, $rule)
    109118    {
     
    117126        return $result;
    118127    }
     128
    119129    public function search($keyword, $page=1, $limit=30)
    120130    {
     
    131141                            'limit'  => $limit,
    132142                            'total'  => 'true',
    133                             'offset' => $page-1,
     143                            'offset' => ($page-1)*$limit,
    134144                        ),
    135145                        'url' => 'http://music.163.com/api/cloudsearch/pc',
     
    142152                $API=array(
    143153                    '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',
    146157                        'p'        => $page,
    147158                        'n'        => $limit,
     
    150161                        'lossless' => 1,
    151162                        'cr'       => 1,
    152                     ),
    153                     'decode' => 'jsonp2json',
     163                        'new_json' => 1,
     164                    ),
    154165                    'format' => 'data#song#list',
    155166                );
     
    212223        return $this->curl($API);
    213224    }
     225
    214226    public function song($id)
    215227    {
     
    235247                    'url'    => 'https://c.y.qq.com/v8/fcg-bin/fcg_play_single_song.fcg',
    236248                    'body'   => array(
    237                         'songmid' => $id,
    238                         'format'  => 'json',
     249                        'songmid'  => $id,
     250                        'platform' => 'yqq',
     251                        'format'   => 'json',
    239252                    ),
    240253                    'decode' => 'tencent_singlesong',
     
    258271                $API=array(
    259272                    'method' => 'POST',
    260                     'url'    => 'http://m.kugou.com/app/i/getSongInfo.php?',
     273                    'url'    => 'http://m.kugou.com/app/i/getSongInfo.php',
    261274                    'body'   => array(
    262275                        "cmd"  => "playInfo",
     
    287300        return $this->curl($API);
    288301    }
     302
    289303    public function album($id)
    290304    {
     
    308322                $API=array(
    309323                    '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',
    311325                    'body'   => array(
    312326                        'albummid' => $id,
    313                     ),
    314                     'format' => 'data#list',
     327                        'platform' => 'mac',
     328                        'format'   => 'json',
     329                        'newsong'  => 1,
     330                    ),
     331                    'format' => 'data#getSongInfo',
    315332                );
    316333                break;
     
    362379        return $this->curl($API);
    363380    }
     381
    364382    public function artist($id, $limit=50)
    365383    {
     
    390408                        'begin'     => 0,
    391409                        'num'       => $limit,
     410                        'order'     => 'listen',
     411                        'platform'  => 'mac',
     412                        'newsong'   => 1,
    392413                    ),
    393414                    'format' => 'data#list',
     
    444465        return $this->curl($API);
    445466    }
     467
    446468    public function playlist($id)
    447469    {
     
    466488                $API=array(
    467489                    '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',
    476498                );
    477499                break;
     
    523545        return $this->curl($API);
    524546    }
     547
    525548    public function url($id, $br=320)
    526549    {
     
    548571                    'body'   => array(
    549572                        'songmid' => $id,
     573                        'platform' => 'yqq',
    550574                        'format'  => 'json',
    551575                    ),
     
    603627        return $this->curl($API);
    604628    }
     629
    605630    public function lyric($id)
    606631    {
     
    631656                    'body'   => array(
    632657                        'songmid'  => $id,
    633                         'g_tk'     => 5381,
     658                        'g_tk'     => '5381',
    634659                    ),
    635660                    'decode' => 'tencent_lyric',
     
    682707        return $this->curl($API);
    683708    }
     709
    684710    public function pic($id, $size=300)
    685711    {
     
    717743        return json_encode(array('url'=>$url));
    718744    }
     745
    719746    private function curlset()
    720747    {
    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
    750791    /**
    751792     * 乱七八糟的函数,加密解密...
     
    763804        }
    764805        $body=strtoupper(bin2hex(base64_decode($body)));
     806
    765807        $API['body']=array(
    766808            'eparams'=>$body,
    767809        );
    768810        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, '();');
    776811    }
    777812    private function tencent_singlesong($result)
     
    808843        $data=json_decode($result, 1);
    809844        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'])) {
    815848            $url=array(
    816849                'url' => $data['data'][0]['url'],
     
    833866            'url'    => 'https://c.y.qq.com/base/fcgi-bin/fcg_musicexpress.fcg',
    834867            'body'   => array(
    835                 'json' => 3,
    836                 'guid' => $GUID,
     868                'json'   => 3,
     869                'guid'   => $GUID,
     870                'format' => 'json',
    837871            ),
    838             'decode' => 'jsonp2json',
    839872        );
    840873        $KEY=json_decode($this->curl($API), 1);
    841874        $KEY=$KEY['key'];
     875
    842876        $type=array(
    843877            'size_320mp3' => array(320,'M800','mp3'),
     878            'size_192aac' => array(192,'C600','m4a'),
    844879            'size_128mp3' => array(128,'M500','mp3'),
    845880            'size_96aac'  => array(96 ,'C400','m4a'),
     
    890925            $urlt=str_replace('^', '0', urldecode($urlt));
    891926            $url=array(
    892               'url' => str_replace('http://','https://',urldecode($urlt)),
    893               'br'  => 320,
     927                'url' => str_replace('http://','https://',urldecode($urlt)),
     928                'br'  => 320,
    894929            );
    895930        } else {
     
    904939    {
    905940        $data=json_decode($result, 1);
     941
    906942        $max=0;
    907943        $url=array();
     
    9731009    private function tencent_lyric($result)
    9741010    {
    975         $result=$this->jsonp2json($result);
     1011        $result=substr($result,18,-1);
    9761012        if (!$this->_FORMAT) {
    9771013            return $result;
     
    10691105        }
    10701106        $result=array(
    1071             'id'        => $data['songmid'],
    1072             'name'      => $data['songname'],
     1107            'id'        => $data['mid'],
     1108            'name'      => $data['name'],
    10731109            'artist'    => array(),
    1074             'album'     => isset($data['albumname'])?$data['albumname']:$data['album']['name'],
    1075             'pic_id'    => $data['albummid'],
    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'],
    10781114            'source'    => 'tencent',
    10791115        );
  • netease-music/trunk/neteasemusic.php

    r1775392 r1796335  
    44Plugin URI: https://fatesinger.com/74369
    55Description: WordPress 音乐播放器,支持网易云音乐和虾米音乐。
    6 Version: 3.0.7
     6Version: 3.0.8
    77Author: bigfa
    88Author URI: https://fatesinger.com/
    99*/ 
    1010
    11 define('NM_VERSION', '3.0.7');
     11define('NM_VERSION', '3.0.8');
    1212define('NM_URL', plugins_url('', __FILE__));
    1313define('NM_PATH', dirname( __FILE__ ));
  • netease-music/trunk/readme.txt

    r1775392 r1796335  
    3131
    3232== Changelog ==
     33= 3.0.8 =
     34* 错误修复与样式改进
     35
    3336= 3.0.7 =
    3437* 如果当前歌曲无法播放则自动切换下一曲
Note: See TracChangeset for help on using the changeset viewer.