From 4d483472cf8d7b7a3fe61c5bc8cbe7df713a643a Mon Sep 17 00:00:00 2001 From: chen_10 <1803012703@qq.com> Date: Tue, 5 Dec 2023 08:56:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20=E6=9D=9C=E6=AF=94?= =?UTF-8?q?=E5=85=A8=E6=99=AF=E5=A3=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addon.py | 4 ++++ addon.xml | 2 +- api.py | 14 +++++++------- .../language/resource.language.zh_cn/strings.po | 4 ++++ resources/settings.xml | 2 +- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/addon.py b/addon.py index e571d2b..319497c 100644 --- a/addon.py +++ b/addon.py @@ -157,6 +157,8 @@ def logout(): level = 'sky' elif quality == '7': level = 'jymaster' +elif quality == '8': + level = 'dolby' else: level = 'standard' @@ -446,6 +448,8 @@ def get_songs_items(datas, privileges=[], picUrl=None, offset=0, getmv=True, sou label += tag(' 沉浸声') elif play['privilege']['playMaxBrLevel'] == 'jymaster': label += tag(' 超清母带') + elif play['privilege']['playMaxBrLevel'] == 'dolby': + label += tag(' 杜比全景声') elif play['privilege']['maxbr'] >= 999000: label += tag(' SQ') # payed: 0 未付费 | 3 付费单曲 | 5 付费专辑 diff --git a/addon.xml b/addon.xml index 3a9df5d..17200a5 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/api.py b/api.py index b37cbc3..c238a9f 100644 --- a/api.py +++ b/api.py @@ -45,10 +45,6 @@ def __init__(self): self.session = requests.Session() self.session.cookies = cookie_jar - if 'appver' not in self.session.cookies: - cookie = self.make_cookie('appver', '8.10.10') - self.session.cookies.set_cookie(cookie) - for cookie in cookie_jar: if cookie.is_expired(): cookie_jar.clear() @@ -106,7 +102,7 @@ def make_cookie(self, name, value): rest={}, ) - def request(self, method, path, params={}, default={"code": -1}, custom_cookies={'os': 'android'}, return_json=True): + def request(self, method, path, params={}, default={"code": -1}, custom_cookies={'os': 'android', 'appver': '8.20.20'}): endpoint = "{}{}".format(BASE_URL, path) csrf_token = "" for cookie in self.session.cookies: @@ -268,8 +264,12 @@ def songs_url(self, ids, bitrate): def songs_url_v1(self, ids, level): path = "/weapi/song/enhance/player/url/v1" - params = dict(ids=ids, level=level, encodeType='flac') - return self.request("POST", path, params) + if level == 'dolby': + params = dict(ids=ids, level='hires', effects='["dolby"]', encodeType='mp4') + return self.request("POST", path, params, custom_cookies={'os': 'pc', 'appver': '2.10.11.201538'}) + else: + params = dict(ids=ids, level=level, encodeType='flac') + return self.request("POST", path, params) # lyric http://music.163.com/api/song/lyric?os=osx&id= &lv=-1&kv=-1&tv=-1 def song_lyric(self, music_id): diff --git a/resources/language/resource.language.zh_cn/strings.po b/resources/language/resource.language.zh_cn/strings.po index 82e4fb0..7314411 100644 --- a/resources/language/resource.language.zh_cn/strings.po +++ b/resources/language/resource.language.zh_cn/strings.po @@ -95,6 +95,10 @@ msgctxt "#30023" msgid "Master" msgstr "超清母带" +msgctxt "#30100" +msgid "Dolby" +msgstr "杜比全景声" + msgctxt "#30024" msgid "Video resolution" msgstr "默认画质" diff --git a/resources/settings.xml b/resources/settings.xml index 349717f..fd75d03 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -19,7 +19,7 @@ - +