diff options
author | Alexandre Flament <alex@al-f.net> | 2020-11-26 17:22:54 +0100 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2020-12-03 10:22:48 +0100 |
commit | 64cccae99e625f3ebd879f94797decd0d824608d (patch) | |
tree | 7ef098d4630c5416aad58f0d3ce5abb27390423f /searx/engines/google_images.py | |
parent | ad72803ed98760b2a95690dea3b95eacc670427c (diff) | |
download | searxng-64cccae99e625f3ebd879f94797decd0d824608d.tar.gz searxng-64cccae99e625f3ebd879f94797decd0d824608d.zip |
[mod] various engines: use eval_xpath* functions and searx.exceptions.*
Engine list: ahmia, duckduckgo_images, elasticsearch, google, google_images, google_videos, youtube_api
Diffstat (limited to 'searx/engines/google_images.py')
-rw-r--r-- | searx/engines/google_images.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/searx/engines/google_images.py b/searx/engines/google_images.py index a3daf6070..9ef1be753 100644 --- a/searx/engines/google_images.py +++ b/searx/engines/google_images.py @@ -26,8 +26,8 @@ Definitions`_. from urllib.parse import urlencode, urlparse, unquote from lxml import html -from flask_babel import gettext from searx import logger +from searx.exceptions import SearxEngineCaptchaException from searx.utils import extract_text, eval_xpath from searx.engines.google import _fetch_supported_languages, supported_languages_url # NOQA # pylint: disable=unused-import @@ -128,10 +128,10 @@ def response(resp): # detect google sorry resp_url = urlparse(resp.url) if resp_url.netloc == 'sorry.google.com' or resp_url.path == '/sorry/IndexRedirect': - raise RuntimeWarning('sorry.google.com') + raise SearxEngineCaptchaException() if resp_url.path.startswith('/sorry'): - raise RuntimeWarning(gettext('CAPTCHA required')) + raise SearxEngineCaptchaException() # which subdomain ? # subdomain = resp.search_params.get('google_subdomain') |