feat: 支持tx/kg源歌曲信息获取

This commit is contained in:
helloplhm-qwq
2023-12-16 18:36:27 +08:00
parent 34eb8403b5
commit c01d1ed9fb
11 changed files with 571 additions and 277 deletions

View File

@ -14,11 +14,11 @@ from common import config
from common import lxsecurity
from common import log
from common import Httpx
from modules import handleApiRequest
from aiohttp.web import Response
import ujson as json
import threading
import traceback
import modules
import time
def handleResult(dic, status = 200):
@ -91,8 +91,8 @@ async def handle(request):
return handleResult({"code": 1, "msg": "lxm请求头验证失败", "data": None}, 403)
try:
return handleResult(await handleApiRequest(method, source, songId, quality))
except Exception as e:
return handleResult(await getattr(modules, method)(source, songId, quality))
except:
logger.error(traceback.format_exc())
return handleResult({'code': 4, 'msg': '内部服务器错误', 'data': None}, 500)
@ -105,6 +105,7 @@ app.router.add_get('/', main)
# api
app.router.add_get('/{method}/{source}/{songId}/{quality}', handle)
app.router.add_get('/{method}/{source}/{songId}', handle)
# 404
app.router.add_route('*', '/{tail:.*}', handle_404)