From 31dd3303543d9f55561eba2e67cab8a4e3d6449f Mon Sep 17 00:00:00 2001 From: MaiCong Date: Thu, 24 May 2018 11:28:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BD=91=E6=98=93=E4=BA=91?= =?UTF-8?q?=E9=9F=B3=E4=B9=90=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/music.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/core/music.php b/core/music.php index ca3456b..f15fd0d 100644 --- a/core/music.php +++ b/core/music.php @@ -1059,6 +1059,29 @@ function mc_get_song_by_id($songid, $site = 'netease', $multi = false) break; case 'netease': default: + if (MC_INTERNAL) { + $radio_streams = [ + 'method' => 'POST', + 'url' => 'http://music.163.com/api/linux/forward', + 'referer' => 'http://music.163.com/', + 'proxy' => false, + 'body' => encode_netease_data([ + 'method' => 'POST', + 'url' => 'http://music.163.com/api/song/enhance/player/url', + 'params' => [ + 'ids' => is_array($songid) ? $songid : [$songid], + 'br' => 320000, + ] + ]) + ]; + $radio_info = json_decode(mc_curl($radio_streams), true); + $radio_urls = []; + if (!empty($radio_info['data'])) { + foreach ($radio_info['data'] as $val) { + $radio_urls[$val['id']] = $val['url']; + } + } + } foreach ($radio_result as $val) { $radio_json = json_decode($val, true); $radio_data = $radio_json['songs']; @@ -1081,7 +1104,7 @@ function mc_get_song_by_id($songid, $site = 'netease', $multi = false) 'title' => $value['name'], 'author' => $radio_author, 'lrc' => !empty($radio_lrc['lrc']) ? $radio_lrc['lrc']['lyric'] : '', - 'url' => 'http://music.163.com/song/media/outer/url?id=' . $radio_song_id . '.mp3', + 'url' => MC_INTERNAL ? $radio_urls[$radio_song_id] : 'http://music.163.com/song/media/outer/url?id=' . $radio_song_id . '.mp3', 'pic' => $value['album']['picUrl'] . '?param=300x300' ]; }