diff options
| author | Noémi Ványi <kvch@users.noreply.github.com> | 2019-01-07 20:38:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-07 20:38:05 +0100 |
| commit | 491792c1a58f71083f6af663bb6d93e40fa44c9f (patch) | |
| tree | 18d6b7072a2ac8de4e357f9a013c9310589dd2c9 /searx/engines/google.py | |
| parent | 35d82ed6609c8cf5d905493e1593f2cfe57ae88d (diff) | |
| parent | 1a850cf171a2820b3bf52459c4c761e372f90996 (diff) | |
Merge pull request #1446 from MarcAbonce/language_aliases_fix
[fix] Fix queries in Hebrew and Norwegian so they give results in the right language
Diffstat (limited to 'searx/engines/google.py')
| -rw-r--r-- | searx/engines/google.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/searx/engines/google.py b/searx/engines/google.py index 62e7d1170..7a4390fc6 100644 --- a/searx/engines/google.py +++ b/searx/engines/google.py @@ -166,7 +166,7 @@ def extract_text_from_dom(result, xpath): def request(query, params): offset = (params['pageno'] - 1) * 10 - language = match_language(params['language'], supported_languages) + 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 +381,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 |