mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-25 11:26:47 +00:00
真·ID播放功能添加(之前是假的,嗯)
This commit is contained in:
parent
f8a9bbb070
commit
29ae2a76cf
@ -282,10 +282,10 @@
|
||||
},
|
||||
{
|
||||
"name": "neteasemusic",
|
||||
"version": "2.6",
|
||||
"version": "2.7",
|
||||
"section": "daily",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "24.4 kb",
|
||||
"size": "24.3 kb",
|
||||
"supported": true,
|
||||
"des-short": "网易云点歌",
|
||||
"des": "可以在线搜索并且快速点歌,歌曲信息齐全,支持直接回复点歌。命令:nem。"
|
||||
|
@ -115,7 +115,7 @@ async def nem(context):
|
||||
search = ".*歌曲ID: (.*)\n.*"
|
||||
title = ".*歌名: (.*?)\n.*"
|
||||
title = "【"+re.findall(title, msg, re.S)[0]+"】"
|
||||
keyword = re.findall(search, msg, re.S)[0]
|
||||
idplay = re.findall(search, msg, re.S)[0]
|
||||
if reply.sender.is_self:
|
||||
await reply.edit(f"{title}点歌完成")
|
||||
except:
|
||||
@ -141,18 +141,18 @@ async def nem(context):
|
||||
proxies = proxy[proxynum]
|
||||
proxynum += 1
|
||||
if idplay: # 指定ID播放
|
||||
idurl = 'https://music.163.com/song?id=' + idplay
|
||||
text = requests.get(url=idurl, headers=headers).text
|
||||
pattern = re.compile(r'歌曲名《(.*?)》.*?由 (.*?) 演唱.*?')
|
||||
keyword = pattern.findall(
|
||||
text)[0][0] + " " + pattern.findall(text)[0][1]
|
||||
url = "http://music.163.com/api/search/pc?&s=" + \
|
||||
keyword + "&offset=0&limit=1&type=1"
|
||||
# 普通搜索+播放
|
||||
url = "http://music.163.com/api/song/detail?id="+ idplay +"&ids=[" + idplay + "]"
|
||||
# 搜索后播放
|
||||
req = requests.request("GET", url, headers=headers)
|
||||
if req.status_code == 200:
|
||||
req = json.loads(req.content)
|
||||
if req['result']:
|
||||
if req['code'] == 200:
|
||||
if idplay:
|
||||
req['result'] = req
|
||||
result = req['result']
|
||||
else:
|
||||
result = False
|
||||
if result:
|
||||
info = {'id': '', 'title': '', 'alias': '',
|
||||
'album': '', 'albumpic': '', 'artist': '', 'br': ''}
|
||||
info['id'] = req['result']['songs'][0]['id']
|
||||
|
Loading…
Reference in New Issue
Block a user