From 7b9ba65f1b6436c26b1597dec7c1c57ce0e97c0a Mon Sep 17 00:00:00 2001 From: blank X Date: Thu, 24 Dec 2020 23:10:48 +0700 Subject: [PATCH] Actually use images from pixiv --- sukuinote/plugins/saucenao.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sukuinote/plugins/saucenao.py b/sukuinote/plugins/saucenao.py index 50bec09..aa9df4a 100644 --- a/sukuinote/plugins/saucenao.py +++ b/sukuinote/plugins/saucenao.py @@ -78,13 +78,16 @@ async def saucenao(client, message): async with session.get(f'https://www.pixiv.net/touch/ajax/illust/details?illust_id={urlencode(qs["illust_id"][0])}', headers={'Accept': 'application/json'}) as resp: json = await resp.json() if json['body']: + to_break = False for i in ('url_big', 'url', 'url_s', 'url_placeholder', 'url_ss'): pimg = json['body']['illust_details'].get(i) if pimg: if await download_file(pimg, filename, url): if os.path.getsize(filename) < 10000000: - to_image = True + to_image = to_break = True break + if to_break: + break if await download_file(url, filename): with open(filename) as file: soup = BeautifulSoup(file.read())