fixed api calls?

This commit is contained in:
pau sch 2022-07-15 09:22:21 +02:00
parent c31b207ffc
commit 1bc220f62e

View file

@ -3,7 +3,7 @@
""" """
Derpibooru (Images) Derpibooru (Images)
""" """
from urllib.parse import urlencode from urllib.parse import urlencode, urlparse, urlunparse, parse_qsl
from json import loads from json import loads
# about # about
@ -38,13 +38,13 @@ def response(resp):
if 'images' in json_data: if 'images' in json_data:
for result in json_data['images']: for result in json_data['images']:
logger.debug("query --> %s", result.get(result['representations']['thumb'])) logger.debug("query --> %s", result['representations']['thumb'])
results.append( results.append(
{ {
'template': 'images.html', 'template': 'images.html',
'url': 'https://derpibooru.org/images/' + str(result.get('id')), 'url': 'https://derpibooru.org/images/' + str(result.get('id')),
'thumbnail_src': result.get(result['representations']['thumb']), 'thumbnail_src': result['representations']['thumb'],
'img_src': result.get(result['representations']['full']), 'img_src': result['representations']['full'],
'title': result.get('name') or 'unknown', 'title': result.get('name') or 'unknown',
'content': result.get('description') or '', 'content': result.get('description') or '',
} }