Add files via upload

下载网易云音乐和舔狗日记
This commit is contained in:
xmengnet 2021-04-14 20:41:56 +08:00 committed by GitHub
parent 766bfa8436
commit 9466bff17c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 0 deletions

29
worker/song.py Normal file
View file

@ -0,0 +1,29 @@
from zzcore import StdAns
import requests
import urllib3
urllib3.disable_warnings()
class Ans(StdAns):
def GETMSG(self):
# self.parms[]
if len(self.parms) < 2:
return '不加参数是坏文明!'
url = 'https://music.xmengnet.cn/api'
try:
# print(self.parms[1])
getid = requests.get(url + '/search?keywords=' + self.raw_msg['raw_message'][5:], verify=False).json()
id = getid['result']['songs'][0]['id']
# print(id)
downurl = requests.get(url + '/song/url?id=' + str(id), verify=False).json()
# print(downurl)
down = downurl['data'][0]['url']
song = getid['result']['songs'][0]['name'] + '-' \
+ getid['result']['songs'][0]['artists'][0]['name']
msg = f"[CQ:reply,id={self.raw_msg['message_id']}]"
return msg+song+'的下载地址为:'+down
# msg = f'[CQ:music,type=163,id={id}]'
except Exception as e:
print(e)
msg = '什么东西坏掉了,大概是网易云吧...不可能是咱!'
return msg

20
worker/tiangou.py Normal file
View file

@ -0,0 +1,20 @@
from zzcore import StdAns, mysakuya
import requests
class Ans(StdAns):
#AllowGroup = [874769998,596678277]
def GETMSG(self):
msg = f"[CQ:reply,id={self.raw_msg['message_id']}]"
try:
msg += tiangou()
except:
msg += '可能是api坏掉了可不是咱'
return msg
def tiangou():
r = requests.get(url='https://api.muxiaoguo.cn/api/tiangourj').json()
# print(r)
msg = None
if r['msg'] == 'success':
msg = r['data']['comment']
return msg