From a7de409535018e596c0c3ddaa1adf7c0f9227537 Mon Sep 17 00:00:00 2001 From: blank X Date: Thu, 24 Dec 2020 23:08:05 +0700 Subject: [PATCH] Don't use images from pixiv over 10MB --- sukuinote/plugins/saucenao.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sukuinote/plugins/saucenao.py b/sukuinote/plugins/saucenao.py index 8ce8c00..50bec09 100644 --- a/sukuinote/plugins/saucenao.py +++ b/sukuinote/plugins/saucenao.py @@ -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())