Merge pull request #33 from TNTcraftHIM/master

NeteaseMusic调整了代码逻辑,下载速度提升了
This commit is contained in:
Pentacene 2020-08-27 23:51:35 +08:00 committed by GitHub
commit d237f240c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -282,10 +282,10 @@
},
{
"name": "neteasemusic",
"version": "1.5",
"version": "1.6",
"section": "daily",
"maintainer": "TNTcraftHIM",
"size": "22.3 kb",
"size": "22.2 kb",
"supported": true,
"des-short": "网易云点歌",
"des": "可以在线搜索并且快速点歌歌曲信息齐全支持直接回复点歌。命令nem。"

View File

@ -278,7 +278,7 @@ async def nem(context):
song_id=self.song_id)
# 发送请求
request = requests.post(
url=self.url, headers=self.headers, data=data)
url=self.url, headers=self.headers, data=data, proxies=proxies, verify=False)
# 初始化real_url
real_url = ''
# 处理返回信息
@ -307,10 +307,10 @@ async def nem(context):
file = name
# 开始下载
content = requests.get(
url=real_url, headers=self.headers, proxies=proxies, verify=False).content
url=real_url, headers=self.headers).content
with open(file, 'wb') as fp:
fp.write(content)
for __ in range(3): #最多尝试3
for __ in range(6): #最多尝试6
try:
WangyiyunDownload().download()
ccimported = True
@ -333,7 +333,7 @@ async def nem(context):
continue
else:
music = requests.request(
"GET", music['data']['url'], headers=headers, proxies=proxies, verify=False)
"GET", music['data']['url'], headers=headers)
else:
continue
@ -351,15 +351,15 @@ async def nem(context):
except:
pass
await context.delete()
res = '你可以点击<a href="https://music.163.com/#/song?id=' + \
res = '或者你可以点击<a href="https://music.163.com/#/song?id=' + \
str(info['id']) + '">' + \
' <strong>这里</strong> ' + '</a>' + '前往网页版收听'
await bot.send_message(context.chat_id, f"<strong>【{info['title']}】</strong>\n" + "歌曲获取失败,可能歌曲资源受限受到地区版权限制或为VIP资源\n" + res, parse_mode='html', link_preview=True)
await bot.send_message(context.chat_id, f"<strong>【{info['title']}】</strong>\n" + "歌曲获取失败,资源获取可能受限,你可以再次尝试\n" + res, parse_mode='html', link_preview=True)
return
if imported is True:
await context.edit(f"{title}信息导入中 . . .")
imagedata = requests.get(
info['albumpic'], headers=headers, proxies=proxies, verify=False).content
info['albumpic'], headers=headers).content
tag = eyed3.load(name)
tag.initTag()
tag = tag.tag