|
@@ -13,6 +13,10 @@
|
13
|
13
|
from urllib import urlencode
|
14
|
14
|
from json import loads
|
15
|
15
|
import re
|
|
16
|
+from searx.engines import logger
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+logger = logger.getChild('flickr-noapi')
|
16
|
20
|
|
17
|
21
|
categories = ['images']
|
18
|
22
|
|
|
@@ -62,10 +66,11 @@ def response(resp):
|
62
|
66
|
# From the biggest to the lowest format
|
63
|
67
|
for image_size in image_sizes:
|
64
|
68
|
if image_size in photo['sizes']:
|
65
|
|
- img_src = photo['sizes'][image_size]['displayUrl']
|
|
69
|
+ img_src = photo['sizes'][image_size]['url']
|
66
|
70
|
break
|
67
|
71
|
|
68
|
72
|
if not img_src:
|
|
73
|
+ logger.debug('cannot find valid image size: {0}'.format(repr(photo)))
|
69
|
74
|
continue
|
70
|
75
|
|
71
|
76
|
if 'id' not in photo['owner']:
|
|
@@ -73,9 +78,9 @@ def response(resp):
|
73
|
78
|
|
74
|
79
|
# For a bigger thumbnail, keep only the url_z, not the url_n
|
75
|
80
|
if 'n' in photo['sizes']:
|
76
|
|
- thumbnail_src = photo['sizes']['n']['displayUrl']
|
|
81
|
+ thumbnail_src = photo['sizes']['n']['url']
|
77
|
82
|
elif 'z' in photo['sizes']:
|
78
|
|
- thumbnail_src = photo['sizes']['z']['displayUrl']
|
|
83
|
+ thumbnail_src = photo['sizes']['z']['url']
|
79
|
84
|
else:
|
80
|
85
|
thumbnail_src = img_src
|
81
|
86
|
|