try to fix qymusic
This commit is contained in:
parent
036d43fadd
commit
b4e48fd54b
1 changed files with 34 additions and 32 deletions
|
@ -1,36 +1,38 @@
|
|||
from zzcore import StdAns
|
||||
import requests
|
||||
import re
|
||||
|
||||
class Ans(StdAns):
|
||||
def GETMSG(self):
|
||||
if len(self.parms) < 2:
|
||||
return '歌名都不指定就能搜到歌了?'
|
||||
url = 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp'
|
||||
params = {
|
||||
'ct': 24,
|
||||
'qqmusic_ver': 1298,
|
||||
'new_json': 1,
|
||||
'remoteplace': 'txt.yqq.song',
|
||||
'searchid': '',
|
||||
't': 0,
|
||||
'aggr': 1,
|
||||
'cr': 1,
|
||||
'catZhida': 1,
|
||||
'loseless': 0,
|
||||
'flag_qc': 0,
|
||||
'p': 1,
|
||||
'n': 20,
|
||||
'w':self.raw_msg['message'][8:],
|
||||
}
|
||||
try:
|
||||
resp = requests.get(url=url,params=params)
|
||||
resp = re.match("callback%((.+)%)", resp).json()
|
||||
if resp['data']['song']['totalnum'] == 0:
|
||||
return '辣鸡曲库没这首,或者你的关键词有问题'
|
||||
mid = resp['data']['song']['list'][0]['mid']
|
||||
mname = resp['data']['song']['list'][0]['name']
|
||||
msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']'
|
||||
except Exception as e:
|
||||
print(e)
|
||||
msg = '辣鸡q音,太弟弟了('
|
||||
return msg
|
||||
def GETMSG(self):
|
||||
if len(self.parms) < 2:
|
||||
return '歌名都不指定就能搜到歌了?'
|
||||
url = 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp'
|
||||
params = {
|
||||
'ct': 24,
|
||||
'qqmusic_ver': 1298,
|
||||
'new_json': 1,
|
||||
'remoteplace': 'txt.yqq.song',
|
||||
'searchid': '',
|
||||
't': 0,
|
||||
'aggr': 1,
|
||||
'cr': 1,
|
||||
'catZhida': 1,
|
||||
'loseless': 0,
|
||||
'flag_qc': 0,
|
||||
'p': 1,
|
||||
'n': 20,
|
||||
'w':self.raw_msg['message'][8:],
|
||||
}
|
||||
try:
|
||||
resp = requests.get(url=url,params=params)
|
||||
# print(resp)
|
||||
resp = re.match("callback%((.+)%)", resp).json()
|
||||
if resp['data']['song']['totalnum'] == 0:
|
||||
return '辣鸡曲库没这首,或者你的关键词有问题'
|
||||
mid = resp['data']['song']['list'][0]['mid']
|
||||
mname = resp['data']['song']['list'][0]['name']
|
||||
msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']'
|
||||
except Exception as e:
|
||||
print(e)
|
||||
msg = '辣鸡q音,太弟弟了('
|
||||
return msg
|
||||
|
|
Loading…
Reference in a new issue