Actually use images from pixiv

This commit is contained in:
blank X 2020-12-24 23:10:48 +07:00
parent a7de409535
commit 7b9ba65f1b
1 changed files with 4 additions and 1 deletions

View File

@ -78,12 +78,15 @@ 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: