Ver código fonte

[fix] fix language support of google

Adam Tauber 7 anos atrás
pai
commit
9ab8536479
1 arquivos alterados com 4 adições e 4 exclusões
  1. 4
    4
      searx/engines/google.py

+ 4
- 4
searx/engines/google.py Ver arquivo

@@ -89,7 +89,7 @@ url_map = 'https://www.openstreetmap.org/'\
89 89
 search_path = '/search'
90 90
 search_url = ('https://{hostname}' +
91 91
               search_path +
92
-              '?{query}&start={offset}&gws_rd=cr&gbv=1&lr={lang}&ei=x')
92
+              '?{query}&start={offset}&gws_rd=cr&gbv=1&hl={lang}&ei=x')
93 93
 
94 94
 time_range_search = "&tbs=qdr:{range}"
95 95
 time_range_dict = {'day': 'd',
@@ -167,11 +167,11 @@ def request(query, params):
167 167
     if params['language'] == 'all':
168 168
         language = 'en'
169 169
         country = 'US'
170
-        url_lang = ''
170
+        url_lang = 'en'
171 171
     elif params['language'][:2] == 'jv':
172 172
         language = 'jw'
173 173
         country = 'ID'
174
-        url_lang = 'lang_jw'
174
+        url_lang = 'jw'
175 175
     else:
176 176
         language_array = params['language'].lower().split('-')
177 177
         if len(language_array) == 2:
@@ -179,7 +179,7 @@ def request(query, params):
179 179
         else:
180 180
             country = 'US'
181 181
         language = language_array[0] + ',' + language_array[0] + '-' + country
182
-        url_lang = 'lang_' + language_array[0]
182
+        url_lang = language_array[0]
183 183
 
184 184
     if use_locale_domain:
185 185
         google_hostname = country_to_hostname.get(country.upper(), default_hostname)