瀏覽代碼

[fix] Google image with special chars

It seems like Google image is doing a double urlencode on the url of the images. So we need to unquote once before sending to the browser the urls.
It solves the 404 we could see with some image with specials chars in url. 
Exemple https://searx.laquadrature.net/?q=etes&pageno=1&category_images (there are two of those in the list)
Cqoicebordel 10 年之前
父節點
當前提交
b973081134
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      searx/engines/google_images.py

+ 2
- 2
searx/engines/google_images.py 查看文件

9
 # @stable      yes (but deprecated)
9
 # @stable      yes (but deprecated)
10
 # @parse       url, title, img_src
10
 # @parse       url, title, img_src
11
 
11
 
12
-from urllib import urlencode
12
+from urllib import urlencode,unquote
13
 from json import loads
13
 from json import loads
14
 
14
 
15
 # engine dependent config
15
 # engine dependent config
52
         results.append({'url': href,
52
         results.append({'url': href,
53
                         'title': title,
53
                         'title': title,
54
                         'content': '',
54
                         'content': '',
55
-                        'img_src': result['url'],
55
+                        'img_src': unquote(result['url']),
56
                         'template': 'images.html'})
56
                         'template': 'images.html'})
57
 
57
 
58
     # return results
58
     # return results