diff options
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 |