mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
parent
78081baa8f
commit
27efdf38c8
@ -13,6 +13,10 @@
|
|||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
from json import loads
|
from json import loads
|
||||||
import re
|
import re
|
||||||
|
from searx.engines import logger
|
||||||
|
|
||||||
|
|
||||||
|
logger = logger.getChild('flickr-noapi')
|
||||||
|
|
||||||
categories = ['images']
|
categories = ['images']
|
||||||
|
|
||||||
@ -62,10 +66,11 @@ def response(resp):
|
|||||||
# From the biggest to the lowest format
|
# From the biggest to the lowest format
|
||||||
for image_size in image_sizes:
|
for image_size in image_sizes:
|
||||||
if image_size in photo['sizes']:
|
if image_size in photo['sizes']:
|
||||||
img_src = photo['sizes'][image_size]['displayUrl']
|
img_src = photo['sizes'][image_size]['url']
|
||||||
break
|
break
|
||||||
|
|
||||||
if not img_src:
|
if not img_src:
|
||||||
|
logger.debug('cannot find valid image size: {0}'.format(repr(photo)))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if 'id' not in photo['owner']:
|
if 'id' not in photo['owner']:
|
||||||
@ -73,9 +78,9 @@ def response(resp):
|
|||||||
|
|
||||||
# For a bigger thumbnail, keep only the url_z, not the url_n
|
# For a bigger thumbnail, keep only the url_z, not the url_n
|
||||||
if 'n' in photo['sizes']:
|
if 'n' in photo['sizes']:
|
||||||
thumbnail_src = photo['sizes']['n']['displayUrl']
|
thumbnail_src = photo['sizes']['n']['url']
|
||||||
elif 'z' in photo['sizes']:
|
elif 'z' in photo['sizes']:
|
||||||
thumbnail_src = photo['sizes']['z']['displayUrl']
|
thumbnail_src = photo['sizes']['z']['url']
|
||||||
else:
|
else:
|
||||||
thumbnail_src = img_src
|
thumbnail_src = img_src
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user