Don't use images from pixiv over 10MB

This commit is contained in:
blank X 2020-12-24 23:08:05 +07:00
parent 5916b87190
commit a7de409535
1 changed files with 3 additions and 2 deletions

View File

@ -82,8 +82,9 @@ async def saucenao(client, message):
pimg = json['body']['illust_details'].get(i)
if pimg:
if await download_file(pimg, filename, url):
to_image = True
break
if os.path.getsize(filename) < 10000000:
to_image = True
break
if await download_file(url, filename):
with open(filename) as file:
soup = BeautifulSoup(file.read())