diff options
author | asciimoo <asciimoo@gmail.com> | 2014-01-31 04:35:23 +0100 |
---|---|---|
committer | asciimoo <asciimoo@gmail.com> | 2014-01-31 04:35:23 +0100 |
commit | 2a788c8f29f63bc069436f1a12343a47d66f2523 (patch) | |
tree | cc44113f213cd565797d3c9a87e8afe72ccf5539 /searx/engines/google.py | |
parent | 90a93422865b81ce256ab02a367a4d3529eb2d18 (diff) | |
download | searxng-2a788c8f29f63bc069436f1a12343a47d66f2523.tar.gz searxng-2a788c8f29f63bc069436f1a12343a47d66f2523.zip |
[enh] search language support init
Diffstat (limited to 'searx/engines/google.py')
-rw-r--r-- | searx/engines/google.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/searx/engines/google.py b/searx/engines/google.py index b90c7adc5..2c6a98af3 100644 --- a/searx/engines/google.py +++ b/searx/engines/google.py @@ -5,16 +5,21 @@ from json import loads categories = ['general'] -paging = True - url = 'https://ajax.googleapis.com/' -search_url = url + 'ajax/services/search/web?v=1.0&start={offset}&rsz=large&safe=off&filter=off&{query}' # noqa +search_url = url + 'ajax/services/search/web?v=2.0&start={offset}&rsz=large&safe=off&filter=off&{query}&hl={language}' # noqa + +paging = True +language_support = True def request(query, params): offset = (params['pageno'] - 1) * 8 + language = 'en-US' + if params['language'] != 'all': + language = params['language'].replace('_', '-') params['url'] = search_url.format(offset=offset, - query=urlencode({'q': query})) + query=urlencode({'q': query}), + language=language) return params |