diff options
Diffstat (limited to 'searx/engines/google.py')
| -rw-r--r-- | searx/engines/google.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/searx/engines/google.py b/searx/engines/google.py index 708068f3a..6aaac2f22 100644 --- a/searx/engines/google.py +++ b/searx/engines/google.py @@ -23,7 +23,7 @@ import babel.languages from searx.utils import extract_text, eval_xpath, eval_xpath_list, eval_xpath_getindex from searx.locales import language_tag, region_tag, get_offical_locales -from searx import network +from searx.network import get # see https://github.com/searxng/searxng/issues/762 from searx.exceptions import SearxEngineCaptchaException from searx.enginelib.traits import EngineTraits @@ -419,11 +419,11 @@ def fetch_traits(engine_traits: EngineTraits, add_domains: bool = True): engine_traits.custom['supported_domains'] = {} - resp = network.get('https://www.google.com/preferences') - if not resp.ok: + resp = get('https://www.google.com/preferences') + if not resp.ok: # type: ignore raise RuntimeError("Response from Google's preferences is not OK.") - dom = html.fromstring(resp.text) + dom = html.fromstring(resp.text) # type: ignore # supported language codes @@ -474,18 +474,18 @@ def fetch_traits(engine_traits: EngineTraits, add_domains: bool = True): # supported domains if add_domains: - resp = network.get('https://www.google.com/supported_domains') - if not resp.ok: + resp = get('https://www.google.com/supported_domains') + if not resp.ok: # type: ignore raise RuntimeError("Response from https://www.google.com/supported_domains is not OK.") - for domain in resp.text.split(): + for domain in resp.text.split(): # type: ignore domain = domain.strip() if not domain or domain in [ '.google.com', ]: continue region = domain.split('.')[-1].upper() - engine_traits.custom['supported_domains'][region] = 'www' + domain + engine_traits.custom['supported_domains'][region] = 'www' + domain # type: ignore if region == 'HK': # There is no google.cn, we use .com.hk for zh-CN - engine_traits.custom['supported_domains']['CN'] = 'www' + domain + engine_traits.custom['supported_domains']['CN'] = 'www' + domain # type: ignore |