diff options
| author | Alexandre Flament <alex@al-f.net> | 2020-12-03 13:23:19 +0100 |
|---|---|---|
| committer | Alexandre Flament <alex@al-f.net> | 2020-12-03 13:23:19 +0100 |
| commit | fa909c7c024d9ec98f6611fde0f99b0e797b1f3b (patch) | |
| tree | 00793b129b8e3cd80a5feee1224c270687c40cae /searx/engines/yandex.py | |
| parent | 7905d4148718816de60cafff8a05ce95f97ce6aa (diff) | |
[mod] stackoverflow & yandex: detect CAPTCHA response
Diffstat (limited to 'searx/engines/yandex.py')
| -rw-r--r-- | searx/engines/yandex.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/searx/engines/yandex.py b/searx/engines/yandex.py index ff1ef5a26..b4a6a54cf 100644 --- a/searx/engines/yandex.py +++ b/searx/engines/yandex.py @@ -9,9 +9,10 @@ @parse url, title, content """ -from urllib.parse import urlencode +from urllib.parse import urlencode, urlparse from lxml import html from searx import logger +from searx.exceptions import SearxEngineCaptchaException logger = logger.getChild('yandex engine') @@ -47,6 +48,10 @@ def request(query, params): # get response from search-request def response(resp): + resp_url = urlparse(resp.url) + if resp_url.path.startswith('/showcaptcha'): + raise SearxEngineCaptchaException() + dom = html.fromstring(resp.text) results = [] |