summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2017-12-05 20:38:34 +0100
committerAdam Tauber <asciimoo@gmail.com>2017-12-05 20:38:34 +0100
commit1613c6319eedb209839ffb3e5e3213613a3bf898 (patch)
tree0ae757da48919945319dcd0d96e4369c1eaac2d0 /searx/engines
parent1435ae7e96984eabd1df43095d27f21e5a5d424a (diff)
downloadsearxng-1613c6319eedb209839ffb3e5e3213613a3bf898.tar.gz
searxng-1613c6319eedb209839ffb3e5e3213613a3bf898.zip
[fix] handle /sorry redirects
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/google.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/searx/engines/google.py b/searx/engines/google.py
index de2717d81..363b7fb6f 100644
--- a/searx/engines/google.py
+++ b/searx/engines/google.py
@@ -9,6 +9,7 @@
# @parse url, title, content, suggestion
import re
+from flask_babel import gettext
from lxml import html, etree
from searx.engines.xpath import extract_text, extract_url
from searx import logger
@@ -209,6 +210,9 @@ def response(resp):
if resp_url.netloc == 'sorry.google.com' or resp_url.path == '/sorry/IndexRedirect':
raise RuntimeWarning('sorry.google.com')
+ if resp_url.path.startswith('/sorry'):
+ raise RuntimeWarning(gettext('CAPTCHA required'))
+
# which hostname ?
google_hostname = resp.search_params.get('google_hostname')
google_url = "https://" + google_hostname