Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1613c631 authored by Adam Tauber's avatar Adam Tauber
Browse files

[fix] handle /sorry redirects

parent 1435ae7e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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