diff --git a/apis/wy/__init__.py b/apis/wy/__init__.py index b94171e..67aa6de 100644 --- a/apis/wy/__init__.py +++ b/apis/wy/__init__.py @@ -19,9 +19,9 @@ '320k': 'exhigh', 'flac': 'lossless', 'flac24bit': 'hires', - "jyeffect": "jyeffect", - "jysky": "jysky", - "jymaster": "jymaster", + "dolby": "jyeffect", + "sky": "jysky", + "master": "jymaster", }, 'cookie': config.read_config('module.wy.user.cookie'), } @@ -43,4 +43,7 @@ async def url(songId, quality): body = json.loads(req.text) if (not body.get("data") or (not body.get("data")) or (not body.get("data")[0].get("url"))): raise FailedException("failed") + if (config.read_config('module.wy.reject_unmatched_quality')): + if (body['data'][0]['level'] != tools['qualityMap'][quality]): + raise FailedException("reject unmatched quality") return body["data"][0]["url"].split("?")[0] diff --git a/common/config.py b/common/config.py index c9670a5..de6c43a 100644 --- a/common/config.py +++ b/common/config.py @@ -165,7 +165,9 @@ class ConfigReadException(Exception): "user": { "desc": "账号cookie数据,可以通过浏览器获取,需要vip账号来获取会员歌曲,如果没有请留为空值", "cookie": "" - } + }, + "reject_unmatcher_quality": True, + "_reject_unmatcher_quality-desc": "是否拒绝不匹配的音质(默认拒绝),网易云API在当前环境无法获取该音质时会自动将低音质,开启此功能将拒绝被降级的音质返回", }, "mg": { "desc": "咪咕音乐相关配置",