diff options
author | asciimoo <asciimoo@gmail.com> | 2013-10-23 23:55:37 +0200 |
---|---|---|
committer | asciimoo <asciimoo@gmail.com> | 2013-10-23 23:55:37 +0200 |
commit | 74b6be3991dc62577aca295de839e51e6d0807d6 (patch) | |
tree | 5bf5df160e765dc7dc6897e640fd23a761df1d2e /searx/engines/google_images.py | |
parent | 39d229e1104dc10c7c7f00380c02d46118e3d895 (diff) | |
download | searxng-74b6be3991dc62577aca295de839e51e6d0807d6.tar.gz searxng-74b6be3991dc62577aca295de839e51e6d0807d6.zip |
[enh] engine cfg compatibilty
Diffstat (limited to 'searx/engines/google_images.py')
-rwxr-xr-x | searx/engines/google_images.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/searx/engines/google_images.py b/searx/engines/google_images.py index cacebeaf1..9b822f544 100755 --- a/searx/engines/google_images.py +++ b/searx/engines/google_images.py @@ -5,15 +5,14 @@ from json import loads categories = ['images'] -search_url = 'https://ajax.googleapis.com/ajax/services/search/images?v=1.0&start=0&rsz=large&safe=off&filter=off&' +url = 'https://ajax.googleapis.com/' +search_url = url + 'ajax/services/search/images?v=1.0&start=0&rsz=large&safe=off&filter=off&{query}' def request(query, params): - global search_url params['url'] = search_url + urlencode({'q': query}) return params def response(resp): - global base_url results = [] search_res = loads(resp.text) if not search_res.get('responseData'): @@ -21,9 +20,9 @@ def response(resp): if not search_res['responseData'].get('results'): return [] for result in search_res['responseData']['results']: - url = result['originalContextUrl'] + href = result['originalContextUrl'] title = result['title'] if not result['url']: continue - results.append({'url': url, 'title': title, 'content': '', 'img_src': result['url'], 'template': 'images.html'}) + results.append({'url': href, 'title': title, 'content': '', 'img_src': result['url'], 'template': 'images.html'}) return results |