Handle pixiv errors
This commit is contained in:
parent
c897b3c598
commit
5916b87190
|
@ -77,6 +77,7 @@ async def saucenao(client, message):
|
||||||
if qs.get('illust_id'):
|
if qs.get('illust_id'):
|
||||||
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:
|
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()
|
json = await resp.json()
|
||||||
|
if json['body']:
|
||||||
for i in ('url_big', 'url', 'url_s', 'url_placeholder', 'url_ss'):
|
for i in ('url_big', 'url', 'url_s', 'url_placeholder', 'url_ss'):
|
||||||
pimg = json['body']['illust_details'].get(i)
|
pimg = json['body']['illust_details'].get(i)
|
||||||
if pimg:
|
if pimg:
|
||||||
|
|
Loading…
Reference in New Issue