diff options
| author | Noémi Ványi <kvch@users.noreply.github.com> | 2019-01-15 22:11:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-15 22:11:26 +0100 |
| commit | 25367cfba13de9bec580d7d495c4e70b8ea8f76d (patch) | |
| tree | bc4f87b06f658d13d8e4f6a553b5ab90ffe00ed8 /searx/engines/google.py | |
| parent | 4977ea5405954107d071235093f01d0246c31fb2 (diff) | |
| parent | 383e3cc554a3704cd8b076aa686f32b8ce78f681 (diff) | |
Merge branch 'master' into setup-no-tests
Diffstat (limited to 'searx/engines/google.py')
| -rw-r--r-- | searx/engines/google.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/searx/engines/google.py b/searx/engines/google.py index 62e7d1170..36ca7a116 100644 --- a/searx/engines/google.py +++ b/searx/engines/google.py @@ -166,7 +166,11 @@ def extract_text_from_dom(result, xpath): def request(query, params): offset = (params['pageno'] - 1) * 10 - language = match_language(params['language'], supported_languages) + if params['language'] == 'all' or params['language'] == 'en-US': + language = 'en-GB' + else: + language = match_language(params['language'], supported_languages, language_aliases) + language_array = language.split('-') if params['language'].find('-') > 0: country = params['language'].split('-')[1] @@ -381,10 +385,10 @@ def attributes_to_html(attributes): def _fetch_supported_languages(resp): supported_languages = {} dom = html.fromstring(resp.text) - options = dom.xpath('//table//td/font/label/span') + options = dom.xpath('//*[@id="langSec"]//input[@name="lr"]') for option in options: - code = option.xpath('./@id')[0][1:] - name = option.text.title() + code = option.xpath('./@value')[0].split('_')[-1] + name = option.xpath('./@data-name')[0].title() supported_languages[code] = {"name": name} return supported_languages |