Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 20, 2024
2 parents 709c4c2 + 0504513 commit 26269e8
Show file tree
Hide file tree
Showing 18 changed files with 87 additions and 73 deletions.
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ black==24.3.0
pylint==3.3.1
splinter==0.21.0
selenium==4.25.0
Pallets-Sphinx-Themes==2.1.3
Pallets-Sphinx-Themes==2.2.0
Sphinx==7.4.7
sphinx-issues==4.1.0
sphinx-issues==5.0.0
sphinx-jinja==2.0.2
sphinx-tabs==3.4.7
sphinxcontrib-programoutput==0.17
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python-dateutil==2.9.0.post0
pyyaml==6.0.2
httpx[http2]==0.24.1
Brotli==1.1.0
uvloop==0.20.0
uvloop==0.21.0
httpx-socks[asyncio]==0.7.7
setproctitle==1.3.3
redis==5.0.8
Expand Down
11 changes: 11 additions & 0 deletions searx/engines/duckduckgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from searx import redisdb
from searx.enginelib.traits import EngineTraits
from searx.utils import extr
from searx.exceptions import SearxEngineCaptchaException

if TYPE_CHECKING:
import logging
Expand Down Expand Up @@ -292,13 +293,23 @@ def request(query, params):
return params


def detect_ddg_captcha(dom):
"""In case of CAPTCHA ddg open its own *not a Robot* dialog and is
not redirected to CAPTCHA page.
"""
if eval_xpath(dom, "//form[@id='challenge-form']"):
# set suspend time to zero is OK --> ddg does not block the IP
raise SearxEngineCaptchaException(suspended_time=0)


def response(resp):

if resp.status_code == 303:
return []

results = []
doc = lxml.html.fromstring(resp.text)
detect_ddg_captcha(doc)

result_table = eval_xpath(doc, '//html/body/form/div[@class="filters"]/table')

Expand Down
12 changes: 7 additions & 5 deletions searx/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Exception types raised by SearXNG modules.
"""
from __future__ import annotations

from typing import Optional, Union

Expand Down Expand Up @@ -61,7 +62,7 @@ class SearxEngineAccessDeniedException(SearxEngineResponseException):
"""This settings contains the default suspended time (default 86400 sec / 1
day)."""

def __init__(self, suspended_time: int = None, message: str = 'Access denied'):
def __init__(self, suspended_time: int | None = None, message: str = 'Access denied'):
"""Generic exception to raise when an engine denies access to the results.
:param suspended_time: How long the engine is going to be suspended in
Expand All @@ -70,12 +71,13 @@ def __init__(self, suspended_time: int = None, message: str = 'Access denied'):
:param message: Internal message. Defaults to ``Access denied``
:type message: str
"""
suspended_time = suspended_time or self._get_default_suspended_time()
if suspended_time is None:
suspended_time = self._get_default_suspended_time()
super().__init__(message + ', suspended_time=' + str(suspended_time))
self.suspended_time = suspended_time
self.message = message

def _get_default_suspended_time(self):
def _get_default_suspended_time(self) -> int:
from searx import get_setting # pylint: disable=C0415

return get_setting(self.SUSPEND_TIME_SETTING)
Expand All @@ -88,7 +90,7 @@ class SearxEngineCaptchaException(SearxEngineAccessDeniedException):
"""This settings contains the default suspended time (default 86400 sec / 1
day)."""

def __init__(self, suspended_time=None, message='CAPTCHA'):
def __init__(self, suspended_time: int | None = None, message='CAPTCHA'):
super().__init__(message=message, suspended_time=suspended_time)


Expand All @@ -102,7 +104,7 @@ class SearxEngineTooManyRequestsException(SearxEngineAccessDeniedException):
"""This settings contains the default suspended time (default 3660 sec / 1
hour)."""

def __init__(self, suspended_time=None, message='Too many request'):
def __init__(self, suspended_time: int | None = None, message='Too many request'):
super().__init__(message=message, suspended_time=suspended_time)


Expand Down
Binary file modified searx/translations/bg/LC_MESSAGES/messages.mo
Binary file not shown.
26 changes: 14 additions & 12 deletions searx/translations/bg/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,23 @@
# Salif Mehmed <[email protected]>, 2023, 2024.
# return42 <[email protected]>, 2024.
# krlsk <[email protected]>, 2024.
# stoychevww <[email protected]>, 2024.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-05-25 08:18+0000\n"
"Last-Translator: krlsk <[email protected]>\n"
"PO-Revision-Date: 2024-10-13 03:30+0000\n"
"Last-Translator: stoychevww <[email protected]>"
"\n"
"Language-Team: Bulgarian <https://translate.codeberg.org/projects/searxng/"
"searxng/bg/>\n"
"Language: bg\n"
"Language-Team: Bulgarian "
"<https://translate.codeberg.org/projects/searxng/searxng/bg/>\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.7.2\n"
"Generated-By: Babel 2.16.0\n"

#. CONSTANT_NAMES['NO_SUBGROUPING']
Expand Down Expand Up @@ -166,7 +169,7 @@ msgstr "тъмен"
#. STYLE_NAMES['BLACK']
#: searx/searxng.msg
msgid "black"
msgstr ""
msgstr "черно"

#. BRAND_CUSTOM_LINKS['UPTIME']
#: searx/searxng.msg
Expand Down Expand Up @@ -334,17 +337,17 @@ msgstr "Автор"
#. SOCIAL_MEDIA_TERMS['THREAD OPEN']
#: searx/engines/discourse.py:149 searx/searxng.msg
msgid "open"
msgstr ""
msgstr "отворено"

#. SOCIAL_MEDIA_TERMS['THREAD CLOSED']
#: searx/engines/discourse.py:149 searx/searxng.msg
msgid "closed"
msgstr ""
msgstr "Затворено"

#. SOCIAL_MEDIA_TERMS['THREAD ANSWERED']
#: searx/engines/discourse.py:160 searx/searxng.msg
msgid "answered"
msgstr ""
msgstr "Отговорено"

#: searx/webapp.py:332
msgid "No item found"
Expand Down Expand Up @@ -453,7 +456,7 @@ msgstr "Изчислете {functions} на аргументите"

#: searx/engines/mozhi.py:57
msgid "Synonyms"
msgstr ""
msgstr "Синоними"

#: searx/engines/openstreetmap.py:159
msgid "Get directions"
Expand Down Expand Up @@ -1975,4 +1978,3 @@ msgstr "скрий видеото"

#~ msgid "Engines cannot retrieve results"
#~ msgstr "Търсачките не можаха да намерят резултати"

Binary file modified searx/translations/fr/LC_MESSAGES/messages.mo
Binary file not shown.
23 changes: 12 additions & 11 deletions searx/translations/fr/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,22 @@
# wags07 <[email protected]>, 2024.
# Aeris1One <[email protected]>, 2024.
# kratos <[email protected]>, 2024.
# hemie143 <[email protected]>, 2024.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-09-24 19:18+0000\n"
"Last-Translator: kratos <[email protected]>\n"
"PO-Revision-Date: 2024-10-18 07:22+0000\n"
"Last-Translator: hemie143 <[email protected]>\n"
"Language-Team: French <https://translate.codeberg.org/projects/searxng/"
"searxng/fr/>\n"
"Language: fr\n"
"Language-Team: French "
"<https://translate.codeberg.org/projects/searxng/searxng/fr/>\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 5.7.2\n"
"Generated-By: Babel 2.16.0\n"

#. CONSTANT_NAMES['NO_SUBGROUPING']
Expand Down Expand Up @@ -179,7 +181,7 @@ msgstr "sombre"
#. STYLE_NAMES['BLACK']
#: searx/searxng.msg
msgid "black"
msgstr ""
msgstr "noir"

#. BRAND_CUSTOM_LINKS['UPTIME']
#: searx/searxng.msg
Expand Down Expand Up @@ -466,7 +468,7 @@ msgstr "Calcule les {functions} des arguments"

#: searx/engines/mozhi.py:57
msgid "Synonyms"
msgstr ""
msgstr "Synonymes"

#: searx/engines/openstreetmap.py:159
msgid "Get directions"
Expand Down Expand Up @@ -1235,11 +1237,11 @@ msgstr "Temps max"

#: searx/templates/simple/preferences/favicon.html:2
msgid "Favicon Resolver"
msgstr ""
msgstr "Résolveur de Favicon"

#: searx/templates/simple/preferences/favicon.html:15
msgid "Display favicons near search results"
msgstr ""
msgstr "Affiche les favicons à côté des résultats de recherche"

#: searx/templates/simple/preferences/footer.html:2
msgid ""
Expand Down Expand Up @@ -2013,4 +2015,3 @@ msgstr "cacher la vidéo"

#~ msgid "Engines cannot retrieve results"
#~ msgstr "Les moteurs ne peuvent pas récupérer de résultats"

Binary file modified searx/translations/nl/LC_MESSAGES/messages.mo
Binary file not shown.
17 changes: 8 additions & 9 deletions searx/translations/nl/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@
# return42 <[email protected]>, 2024.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-09-05 06:18+0000\n"
"Last-Translator: return42 <[email protected]>"
"\n"
"PO-Revision-Date: 2024-10-15 12:18+0000\n"
"Last-Translator: return42 <[email protected]>\n"
"Language-Team: Dutch <https://translate.codeberg.org/projects/searxng/"
"searxng/nl/>\n"
"Language: nl\n"
"Language-Team: Dutch "
"<https://translate.codeberg.org/projects/searxng/searxng/nl/>\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.7.2\n"
"Generated-By: Babel 2.16.0\n"

#. CONSTANT_NAMES['NO_SUBGROUPING']
Expand Down Expand Up @@ -177,7 +177,7 @@ msgstr "donker"
#. STYLE_NAMES['BLACK']
#: searx/searxng.msg
msgid "black"
msgstr ""
msgstr "zwart"

#. BRAND_CUSTOM_LINKS['UPTIME']
#: searx/searxng.msg
Expand Down Expand Up @@ -2004,4 +2004,3 @@ msgstr "verberg video"

#~ msgid "Engines cannot retrieve results"
#~ msgstr "Zoekmachines konden geen resultaten ophalen"

Binary file modified searx/translations/pl/LC_MESSAGES/messages.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions searx/translations/pl/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-10-08 13:41+0000\n"
"PO-Revision-Date: 2024-10-15 12:18+0000\n"
"Last-Translator: return42 <[email protected]>\n"
"Language-Team: Polish <https://translate.codeberg.org/projects/searxng/"
"searxng/pl/>\n"
Expand Down Expand Up @@ -1234,7 +1234,7 @@ msgstr ""

#: searx/templates/simple/preferences/favicon.html:15
msgid "Display favicons near search results"
msgstr ""
msgstr "Wyświetlanie faviconów obok wyników wyszukiwania"

#: searx/templates/simple/preferences/footer.html:2
msgid ""
Expand Down
Binary file modified searx/translations/pt/LC_MESSAGES/messages.mo
Binary file not shown.
21 changes: 11 additions & 10 deletions searx/translations/pt/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,23 @@
# diodio <[email protected]>, 2024.
# gvlx <[email protected]>, 2024.
# ds451 <[email protected]>, 2024.
# Pedro_Tresp <[email protected]>, 2024.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-09-05 06:18+0000\n"
"Last-Translator: return42 <[email protected]>"
"\n"
"PO-Revision-Date: 2024-10-13 23:26+0000\n"
"Last-Translator: Pedro_Tresp <[email protected]."
"org>\n"
"Language-Team: Portuguese <https://translate.codeberg.org/projects/searxng/"
"searxng/pt/>\n"
"Language: pt\n"
"Language-Team: Portuguese "
"<https://translate.codeberg.org/projects/searxng/searxng/pt/>\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Weblate 5.7.2\n"
"Generated-By: Babel 2.16.0\n"

#. CONSTANT_NAMES['NO_SUBGROUPING']
Expand Down Expand Up @@ -460,7 +462,7 @@ msgstr "Calcular {functions} dos argumentos"

#: searx/engines/mozhi.py:57
msgid "Synonyms"
msgstr ""
msgstr "Sinônimos"

#: searx/engines/openstreetmap.py:159
msgid "Get directions"
Expand Down Expand Up @@ -695,7 +697,7 @@ msgstr "Comprimento"

#: searx/templates/simple/macros.html:41
msgid "Views"
msgstr ""
msgstr "Viazualisações"

#: searx/templates/simple/macros.html:42
#: searx/templates/simple/result_templates/files.html:34
Expand Down Expand Up @@ -1997,4 +1999,3 @@ msgstr "esconder vídeo"

#~ msgid "Engines cannot retrieve results"
#~ msgstr "Mecanismos não podem recuperar resultados"

Binary file modified searx/translations/pt_BR/LC_MESSAGES/messages.mo
Binary file not shown.
17 changes: 8 additions & 9 deletions searx/translations/pt_BR/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@
# rafablog77 <[email protected]>, 2024.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-09-05 06:18+0000\n"
"Last-Translator: return42 <[email protected]>"
"\n"
"PO-Revision-Date: 2024-10-15 12:18+0000\n"
"Last-Translator: return42 <[email protected]>\n"
"Language-Team: Portuguese (Brazil) <https://translate.codeberg.org/projects/"
"searxng/searxng/pt_BR/>\n"
"Language: pt_BR\n"
"Language-Team: Portuguese (Brazil) "
"<https://translate.codeberg.org/projects/searxng/searxng/pt_BR/>\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 5.7.2\n"
"Generated-By: Babel 2.16.0\n"

#. CONSTANT_NAMES['NO_SUBGROUPING']
Expand Down Expand Up @@ -1247,7 +1247,7 @@ msgstr ""

#: searx/templates/simple/preferences/favicon.html:15
msgid "Display favicons near search results"
msgstr ""
msgstr "Exibir favicons próximo aos resultados da pesquisa"

#: searx/templates/simple/preferences/footer.html:2
msgid ""
Expand Down Expand Up @@ -2018,4 +2018,3 @@ msgstr "ocultar vídeo"

#~ msgid "Engines cannot retrieve results"
#~ msgstr "Os motores de busca não conseguiram obter resultados"

Binary file modified searx/translations/tr/LC_MESSAGES/messages.mo
Binary file not shown.
Loading

0 comments on commit 26269e8

Please sign in to comment.