Skip to content

Commit

Permalink
chore: 优秀代码
Browse files Browse the repository at this point in the history
  • Loading branch information
helloplhm-qwq committed Jan 6, 2024
1 parent 49c6780 commit da3384b
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 7 deletions.
5 changes: 4 additions & 1 deletion modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 3 additions & 0 deletions modules/tx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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

Expand Down Expand Up @@ -79,3 +80,5 @@ async def info(songid):
async def lyric(songId):
return await _getLyric(songId)

async def mv(vid):
return await _getMvInfo(vid)
82 changes: 76 additions & 6 deletions modules/tx/mv.py
Original file line number Diff line number Diff line change
@@ -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


0 comments on commit da3384b

Please sign in to comment.