chore: 优秀代码

This commit is contained in:
helloplhm-qwq 2024-01-06 15:59:51 +08:00
parent 49c6780c5b
commit da3384b6d4
No known key found for this signature in database
GPG Key ID: 6BE1B64B905567C7
3 changed files with 83 additions and 7 deletions

View File

@ -210,4 +210,7 @@ async def other_with_query(method, source, t, _, query):
'code': 2,
'msg': e.args[0],
'data': None,
}
}
async def info_with_query(source, songid, _, query):
return await other('info', source, songid, None)

View File

@ -11,6 +11,7 @@ from .player import url
from .musicInfo import getMusicInfo as _getInfo
from .utils import formatSinger
from .lyric import getLyric as _getLyric
from .mv import getMvPlayURLandInfo as _getMvInfo
from common import utils
from . import refresh_login
@ -79,3 +80,5 @@ async def info(songid):
async def lyric(songId):
return await _getLyric(songId)
async def mv(vid):
return await _getMvInfo(vid)

View File

@ -1,10 +1,80 @@
# ----------------------------------------
# - mode: python -
# - author: helloplhm-qwq -
# - name: mv.py -
# - project: lx-music-api-server -
# - license: MIT -
# - mode: python -
# - author: helloplhm-qwq -
# - name: mv.py -
# - project: lx-music-api-server -
# - license: MIT -
# ----------------------------------------
# This file is part of the "lx-music-api-server" project.
# 没做
import asyncio
import json
from .utils import signRequest
async def getMvPlayURLandInfo(vid):
info = signRequest({
"comm": {"ct": 24, "cv": 4747474},
"mvinfo": {
"module": "video.VideoDataServer",
"method": "get_video_info_batch",
"param": {
"vidlist": [vid],
"required": [
"vid",
"type",
"sid",
"cover_pic",
"duration",
"singers",
"video_switch",
"msg",
"name",
"desc",
"playcnt",
"pubdate",
"isfav",
"gmid",
"songmid"
],
},
},
}, True)
urlreq = signRequest({
"comm": {
"ct": 24,
"cv": 4747474,
"g_tk": 812935580,
"uin": 0,
"format": "json",
"platform": "yqq"
},
"mvUrl": {
"module": "gosrf.Stream.MvUrlProxy",
"method": "GetMvUrls",
"param": {
"vids": [vid],
"request_typet": 10001,
"addrtype": 3,
"format": 264
}
}
})
res = await asyncio.gather(info, urlreq)
i = res[0]
# output i with formatted json
print(json.dumps(i.json(), indent=2, ensure_ascii = False))
url = res[1]
file_info = {}
urlbody = url.json()
if (urlbody['code'] == 0 and urlbody['mvUrl']['code'] == 0):
for u in url['mvUrl']['data'][vid]['mp4']:
if (u['filetype'] == 0):
if (u['fileSize']):
pass
pass
pass
pass
pass