feat: tx源cdn地址切换

This commit is contained in:
helloplhm-qwq 2023-11-11 21:12:13 +08:00
parent 0618b30dbe
commit aad3a71427
No known key found for this signature in database
GPG Key ID: 6BE1B64B905567C7
3 changed files with 21 additions and 16 deletions

View File

@ -39,6 +39,7 @@ tools = jsobject({
"loginuin": config.read_config("module.tx.user.uin"),
"guid": config.read_config("module.tx.vkeyserver.guid"),
"uin": config.read_config("module.tx.vkeyserver.uin"),
"cdnaddr": config.read_config("module.tx.cdnaddr") if config.read_config("module.tx.cdnaddr") else 'http://ws.stream.qqmusic.qq.com/',
})
@ -81,4 +82,4 @@ async def url(songId, quality):
# js const { purl } = data.req_0.data.midurlinfo[0]
if (not body.req_0.data.midurlinfo[0]['purl']):
raise FailedException('failed')
return 'http://ws.stream.qqmusic.qq.com/' + body.req_0.data.midurlinfo[0]['purl']
return tools.cdnaddr + body.req_0.data.midurlinfo[0]['purl']

View File

@ -141,7 +141,8 @@ default = {
"qqmusic_key": "",
"uin": "",
"_uin-desc": "key对应的QQ号"
}
},
"cdnaddr": "http://ws.stream.qqmusic.qq.com/",
},
"wy": {
"desc": "网易云音乐相关配置",
@ -360,6 +361,7 @@ def push_to_list(key, obj):
def read_config(key):
try:
config = variable.config
keys = key.split('.')
value = config
@ -375,6 +377,9 @@ def read_config(key):
break
return value
except:
logger.warning(f'配置文件{key}不存在')
return None
def initConfig():

View File

@ -11,7 +11,6 @@
import logging
import colorlog
import os
import traceback
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import TerminalFormatter