瀏覽代碼

[fix] flickr-noapi logging ++ use correct image url - fixes #203 #181

Adam Tauber 10 年之前
父節點
當前提交
27efdf38c8
共有 1 個檔案被更改,包括 8 行新增3 行删除
  1. 8
    3
      searx/engines/flickr-noapi.py

+ 8
- 3
searx/engines/flickr-noapi.py 查看文件

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