on master help sign in
[fix] handle /sorry redirects
commit1613c6319eedb209839ffb3e5e3213613a3bf898 authorAdam Tauber <asciimoo@gmail.com> dateTue 5 Dec 2017, 20:38 (9 years ago) parent1435ae7
1 file changed+4
searx/engines/google.py+4
searx/engines/google.py+4
@@ -9,6 +9,7 @@
99# @parse url, title, content, suggestion
1010
1111import re
12+from flask_babel import gettext
1213from lxml import html, etree
1314from searx.engines.xpath import extract_text, extract_url
1415from searx import logger
@@ -209,6 +210,9 @@ def response(resp):
209210 if resp_url.netloc == 'sorry.google.com' or resp_url.path == '/sorry/IndexRedirect':
210211 raise RuntimeWarning('sorry.google.com')
211212
213+ if resp_url.path.startswith('/sorry'):
214+ raise RuntimeWarning(gettext('CAPTCHA required'))
215+
212216 # which hostname ?
213217 google_hostname = resp.search_params.get('google_hostname')
214218 google_url = "https://" + google_hostname