summaryrefslogtreecommitdiff
path: root/searx/engines/google_images.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-01-23 20:21:09 +0100
committerGitHub <noreply@github.com>2021-01-23 20:21:09 +0100
commit7d24850d499eed81e63e7df26b7c8ab544af5ca2 (patch)
treee5113f6f9a4ff6fe2535b2a3b03fe96784099470 /searx/engines/google_images.py
parentf310305c54c3cd1d9fc74f09453294edbd2b5486 (diff)
parent5f92dfcdbe6e6db9781c2b82a2bd8ba4914b89e6 (diff)
Merge pull request #2483 from return42/fix-google-news
[fix] revise of the google-News engine
Diffstat (limited to 'searx/engines/google_images.py')
-rw-r--r--searx/engines/google_images.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/searx/engines/google_images.py b/searx/engines/google_images.py
index 8c2cb9d2a..612682c44 100644
--- a/searx/engines/google_images.py
+++ b/searx/engines/google_images.py
@@ -12,10 +12,9 @@ Definitions`_.
Header set Content-Security-Policy "img-src 'self' data: ;"
"""
-from urllib.parse import urlencode, urlparse, unquote
+from urllib.parse import urlencode, unquote
from lxml import html
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
@@ -23,6 +22,7 @@ from searx.engines.google import (
get_lang_country,
google_domains,
time_range_dict,
+ detect_google_sorry,
)
logger = logger.getChild('google images')
@@ -123,13 +123,7 @@ def response(resp):
"""Get response from google's search request"""
results = []
- # detect google sorry
- resp_url = urlparse(resp.url)
- if resp_url.netloc == 'sorry.google.com' or resp_url.path == '/sorry/IndexRedirect':
- raise SearxEngineCaptchaException()
-
- if resp_url.path.startswith('/sorry'):
- raise SearxEngineCaptchaException()
+ detect_google_sorry(resp)
# which subdomain ?
# subdomain = resp.search_params.get('google_subdomain')