修复了无法删除缓存文件的bug

This commit is contained in:
TNTcraftHIM 2020-08-25 22:16:36 +08:00
parent 071d17a579
commit 9a6dd4662b
2 changed files with 5 additions and 5 deletions

View File

@ -272,10 +272,10 @@
},
{
"name": "neteaseshuffle",
"version": "1.0",
"version": "1.1",
"section": "daily",
"maintainer": "TNTcraftHIM",
"size": "3.1 kb",
"size": "3.0 kb",
"supported": true,
"des-short": "随机网抑热歌",
"des": "从热歌榜随机获取一首歌可以多进程同开且附带歌曲信息。命令ns。"

View File

@ -26,7 +26,7 @@ async def ns(context):
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063',
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"}
music = requests.request("GET", music, headers=headers)
name = "/nstmp" + str(req['data']['name']) + ".mp3"
name = str(req['data']['name']) + ".mp3"
with open(name, 'wb') as f:
f.write(music.content)
if (path.getsize(name) / 1024) < 100:
@ -57,12 +57,12 @@ async def ns(context):
caption=cap,
link_preview=False,
force_document=False)
status = True
break
try:
remove(name)
except:
pass
status = True
break
else:
continue
if status == False: