Compare commits

...

11 Commits

Author SHA1 Message Date
Allen f18ec03428
Merge 21dd524a12 into 0f9694c90b 2024-11-24 02:01:36 +00:00
Markus Heiser 0f9694c90b [clean] Internet Archive Scholar search API no longer exists
Engine was added in #2733 but the API does no longer exists. Related:

- https://github.com/searxng/searxng/issues/4038

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-11-23 17:59:38 +01:00
Markus Heiser ccc4f30b20 [doc] update quantities on the intro page
The quantities on the intro page were partly out of date / example; we already
have 210 engines and not just 70. To avoid having to change the quantities
manually in the future, they are now calculated from the jinja context

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-11-23 16:33:08 +01:00
Markus Heiser c4b874e9b0 [fix] engine Library of Congress: fix API URL loc.gov -> www.loc.gov
Avoid HTTP 404 and redirects. Requests to the JSON/YAML API use the base url [1]

    https://www.loc.gov/{endpoint}/?fo=json

[1] https://www.loc.gov/apis/json-and-yaml/requests/

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-11-23 13:02:24 +01:00
Markus Heiser 7c4e4ebd40 [log] warning with URL in case of 'raise_for_httperror'
In order to be able to implement error handling, it is necessary to know which
URL triggered the exception / the URL has not yet been logged.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-11-23 11:33:19 +01:00
searxng-bot b8f1a329d3 [l10n] update translations from Weblate
6581d89b3 - 2024-11-21 - return42 <return42@users.noreply.translate.codeberg.org>
a342903eb - 2024-11-21 - return42 <return42@users.noreply.translate.codeberg.org>
61d3236b9 - 2024-11-21 - return42 <return42@users.noreply.translate.codeberg.org>
cd03e8cc5 - 2024-11-21 - return42 <return42@users.noreply.translate.codeberg.org>
a2399e23a - 2024-11-20 - tentsbet <tentsbet@users.noreply.translate.codeberg.org>
9a5bcc06d - 2024-11-17 - cherrad <cherrad@users.noreply.translate.codeberg.org>
4364e5ef8 - 2024-11-16 - DiamondBrain113 <DiamondBrain113@users.noreply.translate.codeberg.org>
e3a127ec8 - 2024-11-15 - KinoCineaste <KinoCineaste@users.noreply.translate.codeberg.org>
2024-11-22 10:02:42 +01:00
dependabot[bot] 67f7548573 [upd] pypi: Bump typer-slim from 0.13.0 to 0.13.1
Bumps [typer-slim](https://github.com/fastapi/typer) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/fastapi/typer/releases)
- [Changelog](https://github.com/fastapi/typer/blob/master/docs/release-notes.md)
- [Commits](https://github.com/fastapi/typer/compare/0.13.0...0.13.1)

---
updated-dependencies:
- dependency-name: typer-slim
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-22 09:59:26 +01:00
dependabot[bot] f40fc2dd4f [upd] pypi: Bump setproctitle from 1.3.3 to 1.3.4
Bumps [setproctitle](https://github.com/dvarrazzo/py-setproctitle) from 1.3.3 to 1.3.4.
- [Changelog](https://github.com/dvarrazzo/py-setproctitle/blob/master/HISTORY.rst)
- [Commits](https://github.com/dvarrazzo/py-setproctitle/compare/version-1.3.3...version-1.3.4)

---
updated-dependencies:
- dependency-name: setproctitle
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-22 09:58:19 +01:00
Markus Heiser 10d3af84b8 [fix] engine: duckduckgo - don't quote query string
The query string send to DDG must not be qouted.

The query string was URL-qouted in #4011, but the URL-qouted query string result
in unexpected *URL decoded* and other garbish results as reported in #4019
and #4020.  To test compare the results of a query like::

    !ddg Häuser und Straßen :de
    !ddg Häuser und Straßen :all
    !ddg 房屋和街道 :all
    !ddg 房屋和街道 :zh

Closed:

- [#4019] https://github.com/searxng/searxng/issues/4019
- [#4020] https://github.com/searxng/searxng/issues/4020

Related:

- [#4011] https://github.com/searxng/searxng/pull/4011

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-11-17 18:14:22 +01:00
Markus Heiser 21dd524a12 [fix] unit tests: call searx.search.initialize in test's setUp
Depending on the order the unit tests are executed, the searx.search module is
initalized or not, issue reported in [1]::

    Traceback (most recent call last):
      File "searxng/tests/unit/test_results.py", line 72, in test_result_merge_by_title
        self.container.extend('stract', [fake_result(engine='stract', title='short title')])
      File "searxng/searx/results.py", line 243, in extend
        histogram_observe(standard_result_count, 'engine', engine_name, 'result', 'count')
      File "searxng/searx/metrics/__init__.py", line 49, in histogram_observe
        histogram_storage.get(*args).observe(duration)
        ^^^^^^^^^^^^^^^^^^^^^
      AttributeError: 'NoneType' object has no attribute 'get'

To ensure that the searx.search module is initialized, the

- searx.engines.load_engines is replace by
- searx.search.initialize

[1] https://github.com/searxng/searxng/pull/3932#discussion_r1822406569

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-10-30 14:33:52 +01:00
Allen 0476de443e [enh] use longest title and test get_ordered_results() 2024-10-30 14:33:52 +01:00
30 changed files with 208 additions and 252 deletions

View File

@ -4,26 +4,31 @@ Welcome to SearXNG
*Search without being tracked.* *Search without being tracked.*
SearXNG is a free internet metasearch engine which aggregates results from more .. jinja:: searx
than 70 search services. Users are neither tracked nor profiled. Additionally,
SearXNG can be used over Tor for online anonymity. SearXNG is a free internet metasearch engine which aggregates results from up
to {{engines | length}} :ref:`search services <configured engines>`. Users
are neither tracked nor profiled. Additionally, SearXNG can be used over Tor
for online anonymity.
Get started with SearXNG by using one of the instances listed at searx.space_. Get started with SearXNG by using one of the instances listed at searx.space_.
If you don't trust anyone, you can set up your own, see :ref:`installation`. If you don't trust anyone, you can set up your own, see :ref:`installation`.
.. sidebar:: features .. jinja:: searx
- :ref:`self hosted <installation>` .. sidebar:: features
- :ref:`no user tracking / no profiling <SearXNG protect privacy>`
- script & cookies are optional - :ref:`self hosted <installation>`
- secure, encrypted connections - :ref:`no user tracking / no profiling <SearXNG protect privacy>`
- :ref:`about 200 search engines <configured engines>` - script & cookies are optional
- `about 60 translations <https://translate.codeberg.org/projects/searxng/searxng/>`_ - secure, encrypted connections
- about 100 `well maintained <https://uptime.searxng.org/>`__ instances on searx.space_ - :ref:`{{engines | length}} search engines <configured engines>`
- :ref:`easy integration of search engines <demo online engine>` - `58 translations <https://translate.codeberg.org/projects/searxng/searxng/>`_
- professional development: `CI <https://github.com/searxng/searxng/actions>`_, - about 70 `well maintained <https://uptime.searxng.org/>`__ instances on searx.space_
`quality assurance <https://dev.searxng.org/>`_ & - :ref:`easy integration of search engines <demo online engine>`
`automated tested UI <https://dev.searxng.org/screenshots.html>`_ - professional development: `CI <https://github.com/searxng/searxng/actions>`_,
`quality assurance <https://dev.searxng.org/>`_ &
`automated tested UI <https://dev.searxng.org/screenshots.html>`_
.. sidebar:: be a part .. sidebar:: be a part

View File

@ -11,11 +11,11 @@ httpx[http2]==0.24.1
Brotli==1.1.0 Brotli==1.1.0
uvloop==0.21.0 uvloop==0.21.0
httpx-socks[asyncio]==0.7.7 httpx-socks[asyncio]==0.7.7
setproctitle==1.3.3 setproctitle==1.3.4
redis==5.0.8 redis==5.0.8
markdown-it-py==3.0.0 markdown-it-py==3.0.0
fasttext-predict==0.9.2.2 fasttext-predict==0.9.2.2
tomli==2.0.2; python_version < '3.11' tomli==2.0.2; python_version < '3.11'
msgspec==0.18.6 msgspec==0.18.6
eval_type_backport; python_version < '3.9' eval_type_backport; python_version < '3.9'
typer-slim==0.13.0 typer-slim==0.13.1

View File

@ -6,7 +6,7 @@ DuckDuckGo Lite
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import re import re
from urllib.parse import urlencode, quote_plus from urllib.parse import urlencode
import json import json
import babel import babel
import lxml.html import lxml.html
@ -263,7 +263,7 @@ def request(query, params):
params['url'] = url params['url'] = url
params['method'] = 'POST' params['method'] = 'POST'
params['data']['q'] = quote_plus(query) params['data']['q'] = query
# The API is not documented, so we do some reverse engineering and emulate # The API is not documented, so we do some reverse engineering and emulate
# what https://html.duckduckgo.com/html does when you press "next Page" link # what https://html.duckduckgo.com/html does when you press "next Page" link
@ -381,7 +381,11 @@ def response(resp):
zero_click_info_xpath = '//div[@id="zero_click_abstract"]' zero_click_info_xpath = '//div[@id="zero_click_abstract"]'
zero_click = extract_text(eval_xpath(doc, zero_click_info_xpath)).strip() zero_click = extract_text(eval_xpath(doc, zero_click_info_xpath)).strip()
if zero_click and "Your IP address is" not in zero_click and "Your user agent:" not in zero_click: if zero_click and (
"Your IP address is" not in zero_click
and "Your user agent:" not in zero_click
and "URL Decoded:" not in zero_click
):
current_query = resp.search_params["data"].get("q") current_query = resp.search_params["data"].get("q")
results.append( results.append(

View File

@ -1,71 +0,0 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Internet Archive scholar(science)
"""
from datetime import datetime
from urllib.parse import urlencode
from searx.utils import html_to_text
about = {
"website": "https://scholar.archive.org/",
"wikidata_id": "Q115667709",
"official_api_documentation": "https://scholar.archive.org/api/redoc",
"use_official_api": True,
"require_api_key": False,
"results": "JSON",
}
categories = ['science', 'scientific publications']
paging = True
base_url = "https://scholar.archive.org"
results_per_page = 15
def request(query, params):
args = {
"q": query,
"limit": results_per_page,
"offset": (params["pageno"] - 1) * results_per_page,
}
params["url"] = f"{base_url}/search?{urlencode(args)}"
params["headers"]["Accept"] = "application/json"
return params
def response(resp):
results = []
json = resp.json()
for result in json["results"]:
publishedDate, content, doi = None, '', None
if result['biblio'].get('release_date'):
publishedDate = datetime.strptime(result['biblio']['release_date'], "%Y-%m-%d")
if len(result['abstracts']) > 0:
content = result['abstracts'][0].get('body')
elif len(result['_highlights']) > 0:
content = result['_highlights'][0]
if len(result['releases']) > 0:
doi = result['releases'][0].get('doi')
results.append(
{
'template': 'paper.html',
'url': result['fulltext']['access_url'],
'title': result['biblio'].get('title') or result['biblio'].get('container_name'),
'content': html_to_text(content),
'publisher': result['biblio'].get('publisher'),
'doi': doi,
'journal': result['biblio'].get('container_name'),
'authors': result['biblio'].get('contrib_names'),
'tags': result['tags'],
'publishedDate': publishedDate,
'issns': result['biblio'].get('issns'),
'pdf_url': result['fulltext'].get('access_url'),
}
)
return results

View File

@ -27,7 +27,7 @@ categories = ['images']
paging = True paging = True
endpoint = 'photos' endpoint = 'photos'
base_url = 'https://loc.gov' base_url = 'https://www.loc.gov'
search_string = "/{endpoint}/?sp={page}&{query}&fo=json" search_string = "/{endpoint}/?sp={page}&{query}&fo=json"

View File

@ -233,8 +233,7 @@ class Network:
del kwargs['raise_for_httperror'] del kwargs['raise_for_httperror']
return do_raise_for_httperror return do_raise_for_httperror
@staticmethod def patch_response(self, response, do_raise_for_httperror):
def patch_response(response, do_raise_for_httperror):
if isinstance(response, httpx.Response): if isinstance(response, httpx.Response):
# requests compatibility (response is not streamed) # requests compatibility (response is not streamed)
# see also https://www.python-httpx.org/compatibility/#checking-for-4xx5xx-responses # see also https://www.python-httpx.org/compatibility/#checking-for-4xx5xx-responses
@ -242,8 +241,11 @@ class Network:
# raise an exception # raise an exception
if do_raise_for_httperror: if do_raise_for_httperror:
raise_for_httperror(response) try:
raise_for_httperror(response)
except:
self._logger.warning(f"HTTP Request failed: {response.request.method} {response.request.url}")
raise
return response return response
def is_valid_response(self, response): def is_valid_response(self, response):
@ -269,7 +271,7 @@ class Network:
else: else:
response = await client.request(method, url, **kwargs) response = await client.request(method, url, **kwargs)
if self.is_valid_response(response) or retries <= 0: if self.is_valid_response(response) or retries <= 0:
return Network.patch_response(response, do_raise_for_httperror) return self.patch_response(response, do_raise_for_httperror)
except httpx.RemoteProtocolError as e: except httpx.RemoteProtocolError as e:
if not was_disconnected: if not was_disconnected:
# the server has closed the connection: # the server has closed the connection:

View File

@ -12,7 +12,6 @@ from searx import logger
from searx.engines import engines from searx.engines import engines
from searx.metrics import histogram_observe, counter_add, count_error from searx.metrics import histogram_observe, counter_add, count_error
CONTENT_LEN_IGNORED_CHARS_REGEX = re.compile(r'[,;:!?\./\\\\ ()-_]', re.M | re.U) CONTENT_LEN_IGNORED_CHARS_REGEX = re.compile(r'[,;:!?\./\\\\ ()-_]', re.M | re.U)
WHITESPACE_REGEX = re.compile('( |\t|\n)+', re.M | re.U) WHITESPACE_REGEX = re.compile('( |\t|\n)+', re.M | re.U)
@ -133,7 +132,7 @@ def result_score(result, priority):
weight = 1.0 weight = 1.0
for result_engine in result['engines']: for result_engine in result['engines']:
if hasattr(engines[result_engine], 'weight'): if hasattr(engines.get(result_engine), 'weight'):
weight *= float(engines[result_engine].weight) weight *= float(engines[result_engine].weight)
weight *= len(result['positions']) weight *= len(result['positions'])
@ -332,10 +331,14 @@ class ResultContainer:
return None return None
def __merge_duplicated_http_result(self, duplicated, result, position): def __merge_duplicated_http_result(self, duplicated, result, position):
# using content with more text # use content with more text
if result_content_len(result.get('content', '')) > result_content_len(duplicated.get('content', '')): if result_content_len(result.get('content', '')) > result_content_len(duplicated.get('content', '')):
duplicated['content'] = result['content'] duplicated['content'] = result['content']
# use title with more text
if result_content_len(result.get('title', '')) > len(duplicated.get('title', '')):
duplicated['title'] = result['title']
# merge all result's parameters not found in duplicate # merge all result's parameters not found in duplicate
for key in result.keys(): for key in result.keys():
if not duplicated.get(key): if not duplicated.get(key):
@ -347,7 +350,7 @@ class ResultContainer:
# add engine to list of result-engines # add engine to list of result-engines
duplicated['engines'].add(result['engine']) duplicated['engines'].add(result['engine'])
# using https if possible # use https if possible
if duplicated['parsed_url'].scheme != 'https' and result['parsed_url'].scheme == 'https': if duplicated['parsed_url'].scheme != 'https' and result['parsed_url'].scheme == 'https':
duplicated['url'] = result['parsed_url'].geturl() duplicated['url'] = result['parsed_url'].geturl()
duplicated['parsed_url'] = result['parsed_url'] duplicated['parsed_url'] = result['parsed_url']

View File

@ -137,9 +137,6 @@ class OnlineProcessor(EngineProcessor):
self.engine.request(query, params) self.engine.request(query, params)
# ignoring empty urls # ignoring empty urls
if params['url'] is None:
return None
if not params['url']: if not params['url']:
return None return None

View File

@ -1622,11 +1622,6 @@ engines:
api_site: 'askubuntu' api_site: 'askubuntu'
categories: [it, q&a] categories: [it, q&a]
- name: internetarchivescholar
engine: internet_archive_scholar
shortcut: ias
timeout: 15.0
- name: superuser - name: superuser
engine: stackexchange engine: stackexchange
shortcut: su shortcut: su

View File

@ -18,22 +18,23 @@
# Yahya-Lando <Yahya-Lando@users.noreply.translate.codeberg.org>, 2024. # Yahya-Lando <Yahya-Lando@users.noreply.translate.codeberg.org>, 2024.
# nebras <nebras@users.noreply.translate.codeberg.org>, 2024. # nebras <nebras@users.noreply.translate.codeberg.org>, 2024.
# geekom13 <geekom13@users.noreply.translate.codeberg.org>, 2024. # geekom13 <geekom13@users.noreply.translate.codeberg.org>, 2024.
# cherrad <cherrad@users.noreply.translate.codeberg.org>, 2024.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: searx\n" "Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n" "POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-10-04 07:09+0000\n" "PO-Revision-Date: 2024-11-17 23:56+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>" "Last-Translator: cherrad <cherrad@users.noreply.translate.codeberg.org>\n"
"\n" "Language-Team: Arabic <https://translate.codeberg.org/projects/searxng/"
"searxng/ar/>\n"
"Language: ar\n" "Language: ar\n"
"Language-Team: Arabic "
"<https://translate.codeberg.org/projects/searxng/searxng/ar/>\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : "
"n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n" "Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING'] #. CONSTANT_NAMES['NO_SUBGROUPING']
@ -461,7 +462,7 @@ msgstr "حوسبة معطيات ال{functions}"
#: searx/engines/mozhi.py:57 #: searx/engines/mozhi.py:57
msgid "Synonyms" msgid "Synonyms"
msgstr "" msgstr "مرادفات"
#: searx/engines/openstreetmap.py:159 #: searx/engines/openstreetmap.py:159
msgid "Get directions" msgid "Get directions"
@ -1224,11 +1225,11 @@ msgstr "أقصى مدّة"
#: searx/templates/simple/preferences/favicon.html:2 #: searx/templates/simple/preferences/favicon.html:2
msgid "Favicon Resolver" msgid "Favicon Resolver"
msgstr "" msgstr "محلل أيقونة المفضلة"
#: searx/templates/simple/preferences/favicon.html:15 #: searx/templates/simple/preferences/favicon.html:15
msgid "Display favicons near search results" msgid "Display favicons near search results"
msgstr "" msgstr "عرض المفضلات قرب نتائج البحث"
#: searx/templates/simple/preferences/footer.html:2 #: searx/templates/simple/preferences/footer.html:2
msgid "" msgid ""
@ -1973,4 +1974,3 @@ msgstr "إخفاء الفيديو"
#~ msgid "Engines cannot retrieve results" #~ msgid "Engines cannot retrieve results"
#~ msgstr "لم تتمكن محركات البحث من العثور على أية نتيجة" #~ msgstr "لم تتمكن محركات البحث من العثور على أية نتيجة"

View File

@ -18,9 +18,8 @@ msgstr ""
"Project-Id-Version: searx\n" "Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n" "POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-10-13 03:30+0000\n" "PO-Revision-Date: 2024-11-21 08:13+0000\n"
"Last-Translator: stoychevww <stoychevww@users.noreply.translate.codeberg.org>" "Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
"\n"
"Language-Team: Bulgarian <https://translate.codeberg.org/projects/searxng/" "Language-Team: Bulgarian <https://translate.codeberg.org/projects/searxng/"
"searxng/bg/>\n" "searxng/bg/>\n"
"Language: bg\n" "Language: bg\n"
@ -28,7 +27,7 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.7.2\n" "X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n" "Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING'] #. CONSTANT_NAMES['NO_SUBGROUPING']
@ -59,7 +58,7 @@ msgstr "музика"
#. CATEGORY_NAMES['SOCIAL_MEDIA'] #. CATEGORY_NAMES['SOCIAL_MEDIA']
#: searx/searxng.msg #: searx/searxng.msg
msgid "social media" msgid "social media"
msgstr "социална мрежа" msgstr "социална медия"
#. CATEGORY_NAMES['IMAGES'] #. CATEGORY_NAMES['IMAGES']
#: searx/searxng.msg #: searx/searxng.msg
@ -159,12 +158,12 @@ msgstr "автоматичен"
#. STYLE_NAMES['LIGHT'] #. STYLE_NAMES['LIGHT']
#: searx/searxng.msg #: searx/searxng.msg
msgid "light" msgid "light"
msgstr "светъл" msgstr "светло"
#. STYLE_NAMES['DARK'] #. STYLE_NAMES['DARK']
#: searx/searxng.msg #: searx/searxng.msg
msgid "dark" msgid "dark"
msgstr "тъмен" msgstr "тъмно"
#. STYLE_NAMES['BLACK'] #. STYLE_NAMES['BLACK']
#: searx/searxng.msg #: searx/searxng.msg
@ -364,7 +363,7 @@ msgstr "Грешка при зареждането на следващата с
#: searx/webapp.py:495 searx/webapp.py:898 #: searx/webapp.py:495 searx/webapp.py:898
msgid "Invalid settings, please edit your preferences" msgid "Invalid settings, please edit your preferences"
msgstr "Неправилни настройки, моля проверете предпочитанията си" msgstr "Неправилни настройки, моля редактирайте предпочитанията си"
#: searx/webapp.py:511 #: searx/webapp.py:511
msgid "Invalid settings" msgid "Invalid settings"
@ -412,11 +411,11 @@ msgstr "прокси грешка"
#: searx/webutils.py:57 #: searx/webutils.py:57
msgid "CAPTCHA" msgid "CAPTCHA"
msgstr "Кепча" msgstr "CAPTCHA"
#: searx/webutils.py:58 #: searx/webutils.py:58
msgid "too many requests" msgid "too many requests"
msgstr "твърде много искания" msgstr "твърде много повиквания"
#: searx/webutils.py:59 #: searx/webutils.py:59
msgid "access denied" msgid "access denied"
@ -520,7 +519,7 @@ msgstr ""
#: searx/engines/tineye.py:57 #: searx/engines/tineye.py:57
msgid "The image could not be downloaded." msgid "The image could not be downloaded."
msgstr "Снимката не може да бъде смъкната." msgstr "Снимката не може да бъде свалена."
#: searx/engines/zlibrary.py:138 #: searx/engines/zlibrary.py:138
msgid "Book rating" msgid "Book rating"

View File

@ -13,21 +13,23 @@
# RTRedreovic <RTRedreovic@users.noreply.translate.codeberg.org>, 2023. # RTRedreovic <RTRedreovic@users.noreply.translate.codeberg.org>, 2023.
# Azharjan <alexander.um.edu@gmail.com>, 2023. # Azharjan <alexander.um.edu@gmail.com>, 2023.
# return42 <return42@users.noreply.translate.codeberg.org>, 2024. # return42 <return42@users.noreply.translate.codeberg.org>, 2024.
# KinoCineaste <KinoCineaste@users.noreply.translate.codeberg.org>, 2024.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: searx\n" "Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n" "POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-09-05 06:18+0000\n" "PO-Revision-Date: 2024-11-16 08:04+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>" "Last-Translator: KinoCineaste <KinoCineaste@users.noreply.translate.codeberg."
"\n" "org>\n"
"Language-Team: Esperanto <https://translate.codeberg.org/projects/searxng/"
"searxng/eo/>\n"
"Language: eo\n" "Language: eo\n"
"Language-Team: Esperanto "
"<https://translate.codeberg.org/projects/searxng/searxng/eo/>\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n" "Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING'] #. CONSTANT_NAMES['NO_SUBGROUPING']
@ -78,7 +80,7 @@ msgstr "radio"
#. CATEGORY_NAMES['TV'] #. CATEGORY_NAMES['TV']
#: searx/searxng.msg #: searx/searxng.msg
msgid "tv" msgid "tv"
msgstr "" msgstr "televido"
#. CATEGORY_NAMES['IT'] #. CATEGORY_NAMES['IT']
#: searx/searxng.msg #: searx/searxng.msg
@ -168,7 +170,7 @@ msgstr "malhela"
#. STYLE_NAMES['BLACK'] #. STYLE_NAMES['BLACK']
#: searx/searxng.msg #: searx/searxng.msg
msgid "black" msgid "black"
msgstr "" msgstr "nigra"
#. BRAND_CUSTOM_LINKS['UPTIME'] #. BRAND_CUSTOM_LINKS['UPTIME']
#: searx/searxng.msg #: searx/searxng.msg
@ -1961,4 +1963,3 @@ msgstr "kaŝi videojn"
#~ msgid "Engines cannot retrieve results" #~ msgid "Engines cannot retrieve results"
#~ msgstr "Serĉiloj ne povas retrovi rezultojn" #~ msgstr "Serĉiloj ne povas retrovi rezultojn"

View File

@ -23,19 +23,19 @@
# return42 <return42@users.noreply.translate.codeberg.org>, 2024. # return42 <return42@users.noreply.translate.codeberg.org>, 2024.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: searx\n" "Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n" "POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-09-23 01:18+0000\n" "PO-Revision-Date: 2024-11-21 05:07+0000\n"
"Last-Translator: tentsbet <tentsbet@users.noreply.translate.codeberg.org>" "Last-Translator: tentsbet <tentsbet@users.noreply.translate.codeberg.org>\n"
"\n" "Language-Team: Japanese <https://translate.codeberg.org/projects/searxng/"
"searxng/ja/>\n"
"Language: ja\n" "Language: ja\n"
"Language-Team: Japanese "
"<https://translate.codeberg.org/projects/searxng/searxng/ja/>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n" "Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING'] #. CONSTANT_NAMES['NO_SUBGROUPING']
@ -176,7 +176,7 @@ msgstr "ダーク"
#. STYLE_NAMES['BLACK'] #. STYLE_NAMES['BLACK']
#: searx/searxng.msg #: searx/searxng.msg
msgid "black" msgid "black"
msgstr "" msgstr "ブラック"
#. BRAND_CUSTOM_LINKS['UPTIME'] #. BRAND_CUSTOM_LINKS['UPTIME']
#: searx/searxng.msg #: searx/searxng.msg
@ -463,7 +463,7 @@ msgstr "変数の {functions} を計算する"
#: searx/engines/mozhi.py:57 #: searx/engines/mozhi.py:57
msgid "Synonyms" msgid "Synonyms"
msgstr "" msgstr "類義語"
#: searx/engines/openstreetmap.py:159 #: searx/engines/openstreetmap.py:159
msgid "Get directions" msgid "Get directions"
@ -1202,11 +1202,11 @@ msgstr "最大時間"
#: searx/templates/simple/preferences/favicon.html:2 #: searx/templates/simple/preferences/favicon.html:2
msgid "Favicon Resolver" msgid "Favicon Resolver"
msgstr "" msgstr "Favicon Resolver"
#: searx/templates/simple/preferences/favicon.html:15 #: searx/templates/simple/preferences/favicon.html:15
msgid "Display favicons near search results" msgid "Display favicons near search results"
msgstr "" msgstr "検索結果でfaviconに合いそうなものを表示する"
#: searx/templates/simple/preferences/footer.html:2 #: searx/templates/simple/preferences/footer.html:2
msgid "" msgid ""
@ -1917,4 +1917,3 @@ msgstr "動画を隠す"
#~ msgid "Engines cannot retrieve results" #~ msgid "Engines cannot retrieve results"
#~ msgstr "エンジンは結果を取得できません" #~ msgstr "エンジンは結果を取得できません"

View File

@ -16,16 +16,16 @@ msgstr ""
"Project-Id-Version: PROJECT VERSION\n" "Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n" "POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-07-19 07:09+0000\n" "PO-Revision-Date: 2024-11-21 08:13+0000\n"
"Last-Translator: wazhanudin " "Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
"<wazhanudin@users.noreply.translate.codeberg.org>\n" "Language-Team: Malay <https://translate.codeberg.org/projects/searxng/"
"searxng/ms/>\n"
"Language: ms\n" "Language: ms\n"
"Language-Team: Malay "
"<https://translate.codeberg.org/projects/searxng/searxng/ms/>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n" "Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING'] #. CONSTANT_NAMES['NO_SUBGROUPING']
@ -166,7 +166,7 @@ msgstr "gelap"
#. STYLE_NAMES['BLACK'] #. STYLE_NAMES['BLACK']
#: searx/searxng.msg #: searx/searxng.msg
msgid "black" msgid "black"
msgstr "" msgstr "Hitam"
#. BRAND_CUSTOM_LINKS['UPTIME'] #. BRAND_CUSTOM_LINKS['UPTIME']
#: searx/searxng.msg #: searx/searxng.msg
@ -1690,4 +1690,3 @@ msgstr "sembunyikkan video"
#~ msgid "Engines cannot retrieve results" #~ msgid "Engines cannot retrieve results"
#~ msgstr "Enjin tidak dapat mendapatkan keputusan" #~ msgstr "Enjin tidak dapat mendapatkan keputusan"

View File

@ -18,20 +18,20 @@
# UnD37970UnD <UnD37970UnD@users.noreply.translate.codeberg.org>, 2024. # UnD37970UnD <UnD37970UnD@users.noreply.translate.codeberg.org>, 2024.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: searx\n" "Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n" "POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-09-28 15:23+0000\n" "PO-Revision-Date: 2024-11-21 08:13+0000\n"
"Last-Translator: UnD37970UnD " "Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
"<UnD37970UnD@users.noreply.translate.codeberg.org>\n" "Language-Team: Romanian <https://translate.codeberg.org/projects/searxng/"
"searxng/ro/>\n"
"Language: ro\n" "Language: ro\n"
"Language-Team: Romanian "
"<https://translate.codeberg.org/projects/searxng/searxng/ro/>\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 "
"< 20)) ? 1 : 2;\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < "
"20)) ? 1 : 2;\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n" "Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING'] #. CONSTANT_NAMES['NO_SUBGROUPING']
@ -172,7 +172,7 @@ msgstr "întunecat"
#. STYLE_NAMES['BLACK'] #. STYLE_NAMES['BLACK']
#: searx/searxng.msg #: searx/searxng.msg
msgid "black" msgid "black"
msgstr "" msgstr "negru"
#. BRAND_CUSTOM_LINKS['UPTIME'] #. BRAND_CUSTOM_LINKS['UPTIME']
#: searx/searxng.msg #: searx/searxng.msg
@ -1998,4 +1998,3 @@ msgstr "ascunde video"
#~ msgid "Engines cannot retrieve results" #~ msgid "Engines cannot retrieve results"
#~ msgstr "Motoarele nu pot obține rezultate" #~ msgstr "Motoarele nu pot obține rezultate"

View File

@ -13,20 +13,20 @@
# crnobog <crnobog@users.noreply.translate.codeberg.org>, 2024. # crnobog <crnobog@users.noreply.translate.codeberg.org>, 2024.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: searx\n" "Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n" "POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-09-05 06:18+0000\n" "PO-Revision-Date: 2024-11-21 08:13+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>" "Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
"\n" "Language-Team: Serbian <https://translate.codeberg.org/projects/searxng/"
"searxng/sr/>\n"
"Language: sr\n" "Language: sr\n"
"Language-Team: Serbian "
"<https://translate.codeberg.org/projects/searxng/searxng/sr/>\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n" "Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING'] #. CONSTANT_NAMES['NO_SUBGROUPING']
@ -252,7 +252,7 @@ msgstr "Подне"
#. WEATHER_TERMS['PRESSURE'] #. WEATHER_TERMS['PRESSURE']
#: searx/engines/open_meteo.py:95 searx/searxng.msg #: searx/engines/open_meteo.py:95 searx/searxng.msg
msgid "Pressure" msgid "Pressure"
msgstr "" msgstr "Притисак"
#. WEATHER_TERMS['SUNRISE'] #. WEATHER_TERMS['SUNRISE']
#: searx/engines/duckduckgo_weather.py:81 searx/engines/wttr.py:36 #: searx/engines/duckduckgo_weather.py:81 searx/engines/wttr.py:36
@ -1972,4 +1972,3 @@ msgstr "сакриј видео"
#~ msgid "Engines cannot retrieve results" #~ msgid "Engines cannot retrieve results"
#~ msgstr "Не може повратити резултате" #~ msgstr "Не може повратити резултате"

View File

@ -11,13 +11,15 @@
# vducong <vducong@users.noreply.translate.codeberg.org>, 2024. # vducong <vducong@users.noreply.translate.codeberg.org>, 2024.
# tvminh19 <tvminh19@users.noreply.translate.codeberg.org>, 2024. # tvminh19 <tvminh19@users.noreply.translate.codeberg.org>, 2024.
# KhietVo <KhietVo@users.noreply.translate.codeberg.org>, 2024. # KhietVo <KhietVo@users.noreply.translate.codeberg.org>, 2024.
# DiamondBrain113 <DiamondBrain113@users.noreply.translate.codeberg.org>, 2024.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: searx\n" "Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n" "POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-11-14 14:07+0000\n" "PO-Revision-Date: 2024-11-16 20:44+0000\n"
"Last-Translator: KhietVo <KhietVo@users.noreply.translate.codeberg.org>\n" "Last-Translator: DiamondBrain113 <DiamondBrain113@users.noreply.translate."
"codeberg.org>\n"
"Language-Team: Vietnamese <https://translate.codeberg.org/projects/searxng/" "Language-Team: Vietnamese <https://translate.codeberg.org/projects/searxng/"
"searxng/vi/>\n" "searxng/vi/>\n"
"Language: vi\n" "Language: vi\n"
@ -299,13 +301,13 @@ msgstr "những bài đăng"
#. SOCIAL_MEDIA_TERMS['ACTIVE USERS'] #. SOCIAL_MEDIA_TERMS['ACTIVE USERS']
#: searx/engines/lemmy.py:87 searx/searxng.msg #: searx/engines/lemmy.py:87 searx/searxng.msg
msgid "active users" msgid "active users"
msgstr "" msgstr "Người dùng hoạt động"
#. SOCIAL_MEDIA_TERMS['COMMENTS'] #. SOCIAL_MEDIA_TERMS['COMMENTS']
#: searx/engines/discourse.py:157 searx/engines/hackernews.py:78 #: searx/engines/discourse.py:157 searx/engines/hackernews.py:78
#: searx/engines/lemmy.py:130 searx/searxng.msg #: searx/engines/lemmy.py:130 searx/searxng.msg
msgid "comments" msgid "comments"
msgstr "" msgstr "Bình luận"
#. SOCIAL_MEDIA_TERMS['USER'] #. SOCIAL_MEDIA_TERMS['USER']
#: searx/engines/lemmy.py:129 searx/engines/lemmy.py:164 searx/searxng.msg #: searx/engines/lemmy.py:129 searx/engines/lemmy.py:164 searx/searxng.msg
@ -454,7 +456,7 @@ msgstr "Tính toán {functions} của các đối số"
#: searx/engines/mozhi.py:57 #: searx/engines/mozhi.py:57
msgid "Synonyms" msgid "Synonyms"
msgstr "" msgstr "Đồng nghĩa"
#: searx/engines/openstreetmap.py:159 #: searx/engines/openstreetmap.py:159
msgid "Get directions" msgid "Get directions"
@ -541,9 +543,8 @@ msgid "hash digest"
msgstr "hash băm" msgstr "hash băm"
#: searx/plugins/hostnames.py:103 #: searx/plugins/hostnames.py:103
#, fuzzy
msgid "Hostnames plugin" msgid "Hostnames plugin"
msgstr "Mấy chủ bổ trợ" msgstr "Bổ trợ tên máy chủ"
#: searx/plugins/hostnames.py:104 #: searx/plugins/hostnames.py:104
msgid "Rewrite hostnames, remove results or prioritize them based on the hostname" msgid "Rewrite hostnames, remove results or prioritize them based on the hostname"
@ -578,7 +579,7 @@ msgstr "Địa chỉ IP của bạn: "
#: searx/plugins/self_info.py:31 #: searx/plugins/self_info.py:31
msgid "Your user-agent is: " msgid "Your user-agent is: "
msgstr "" msgstr "Tác nhân người dùng của bạn là: "
#: searx/plugins/tor_check.py:24 #: searx/plugins/tor_check.py:24
msgid "Tor check plugin" msgid "Tor check plugin"
@ -623,7 +624,7 @@ msgstr "Loại bỏ các đối số theo dõi từ URL trả về"
#: searx/plugins/unit_converter.py:29 #: searx/plugins/unit_converter.py:29
msgid "Convert between units" msgid "Convert between units"
msgstr "" msgstr "Chuyển đổi giữa các đại lượng"
#: searx/templates/simple/404.html:4 #: searx/templates/simple/404.html:4
msgid "Page not found" msgid "Page not found"
@ -690,7 +691,7 @@ msgstr "Độ dài"
#: searx/templates/simple/macros.html:41 #: searx/templates/simple/macros.html:41
msgid "Views" msgid "Views"
msgstr "" msgstr "Lượt xem"
#: searx/templates/simple/macros.html:42 #: searx/templates/simple/macros.html:42
#: searx/templates/simple/result_templates/files.html:34 #: searx/templates/simple/result_templates/files.html:34
@ -933,9 +934,8 @@ msgid "Checker"
msgstr "Người kiểm duyệt" msgstr "Người kiểm duyệt"
#: searx/templates/simple/stats.html:131 #: searx/templates/simple/stats.html:131
#, fuzzy
msgid "Failed test" msgid "Failed test"
msgstr "Bản kiểm thử không đạt" msgstr "Bài kiểm tra không đạt"
#: searx/templates/simple/stats.html:132 #: searx/templates/simple/stats.html:132
msgid "Comment(s)" msgid "Comment(s)"
@ -951,7 +951,7 @@ msgstr "Tin nhắn từ công cụ tìm kiếm"
#: searx/templates/simple/elements/engines_msg.html:7 #: searx/templates/simple/elements/engines_msg.html:7
msgid "seconds" msgid "seconds"
msgstr "" msgstr "giây"
#: searx/templates/simple/elements/search_url.html:3 #: searx/templates/simple/elements/search_url.html:3
msgid "Search URL" msgid "Search URL"
@ -1208,11 +1208,11 @@ msgstr ""
#: searx/templates/simple/preferences/engines.html:15 #: searx/templates/simple/preferences/engines.html:15
msgid "Enable all" msgid "Enable all"
msgstr "" msgstr "Bật tất cả"
#: searx/templates/simple/preferences/engines.html:16 #: searx/templates/simple/preferences/engines.html:16
msgid "Disable all" msgid "Disable all"
msgstr "" msgstr "Tắt tất cả"
#: searx/templates/simple/preferences/engines.html:25 #: searx/templates/simple/preferences/engines.html:25
msgid "!bang" msgid "!bang"
@ -1232,11 +1232,11 @@ msgstr "Thời gian tối đa"
#: searx/templates/simple/preferences/favicon.html:2 #: searx/templates/simple/preferences/favicon.html:2
msgid "Favicon Resolver" msgid "Favicon Resolver"
msgstr "" msgstr "Bộ phân giải biểu tượng web"
#: searx/templates/simple/preferences/favicon.html:15 #: searx/templates/simple/preferences/favicon.html:15
msgid "Display favicons near search results" msgid "Display favicons near search results"
msgstr "" msgstr "Hiển thị biểu tượng web gần kết quả tìm kiếm"
#: searx/templates/simple/preferences/footer.html:2 #: searx/templates/simple/preferences/footer.html:2
msgid "" msgid ""

View File

@ -3,7 +3,7 @@
from searx.search import SearchQuery, EngineRef from searx.search import SearchQuery, EngineRef
from searx.search.processors import online from searx.search.processors import online
from searx.engines import load_engines import searx.search
from searx import engines from searx import engines
from tests import SearxTestCase from tests import SearxTestCase
@ -22,10 +22,10 @@ TEST_ENGINE = {
class TestOnlineProcessor(SearxTestCase): # pylint: disable=missing-class-docstring class TestOnlineProcessor(SearxTestCase): # pylint: disable=missing-class-docstring
def setUp(self): def setUp(self):
load_engines([TEST_ENGINE]) searx.search.initialize([TEST_ENGINE])
def tearDown(self): def tearDown(self):
load_engines([]) searx.search.load_engines([])
def _get_params(self, online_processor, search_query, engine_category): def _get_params(self, online_processor, search_query, engine_category):
params = online_processor.get_params(search_query, engine_category) params = online_processor.get_params(search_query, engine_category)

View File

@ -2,26 +2,11 @@
# pylint: disable=missing-module-docstring # pylint: disable=missing-module-docstring
from unittest.mock import MagicMock, Mock from unittest.mock import MagicMock, Mock
from searx.engines import load_engines, mariadb_server from searx.engines import mariadb_server
from tests import SearxTestCase from tests import SearxTestCase
class MariadbServerTests(SearxTestCase): # pylint: disable=missing-class-docstring class MariadbServerTests(SearxTestCase): # pylint: disable=missing-class-docstring
def setUp(self):
load_engines(
[
{
'name': 'mariadb server',
'engine': 'mariadb_server',
'shortcut': 'mdb',
'timeout': 9.0,
'disabled': True,
}
]
)
def tearDown(self):
load_engines([])
def test_init_no_query_str_raises(self): def test_init_no_query_str_raises(self):
self.assertRaises(ValueError, lambda: mariadb_server.init({})) self.assertRaises(ValueError, lambda: mariadb_server.init({}))

View File

@ -1,28 +1,34 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring # pylint: disable=missing-module-docstring
import logging
from datetime import datetime from datetime import datetime
from unittest.mock import Mock from unittest.mock import Mock
from requests import HTTPError from requests import HTTPError
from parameterized import parameterized from parameterized import parameterized
from searx.engines import load_engines, tineye import searx.search
import searx.engines
from tests import SearxTestCase from tests import SearxTestCase
class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
def setUp(self): def setUp(self):
load_engines([{'name': 'tineye', 'engine': 'tineye', 'shortcut': 'tin', 'timeout': 9.0, 'disabled': True}]) searx.search.initialize(
[{'name': 'tineye', 'engine': 'tineye', 'shortcut': 'tin', 'timeout': 9.0, 'disabled': True}]
)
self.tineye = searx.engines.engines['tineye']
self.tineye.logger.setLevel(logging.CRITICAL)
def tearDown(self): def tearDown(self):
load_engines([]) searx.search.load_engines([])
def test_status_code_raises(self): def test_status_code_raises(self):
response = Mock() response = Mock()
response.status_code = 401 response.status_code = 401
response.raise_for_status.side_effect = HTTPError() response.raise_for_status.side_effect = HTTPError()
self.assertRaises(HTTPError, lambda: tineye.response(response)) self.assertRaises(HTTPError, lambda: self.tineye.response(response))
@parameterized.expand([(400), (422)]) @parameterized.expand([(400), (422)])
def test_returns_empty_list(self, status_code): def test_returns_empty_list(self, status_code):
@ -30,7 +36,7 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
response.json.return_value = {} response.json.return_value = {}
response.status_code = status_code response.status_code = status_code
response.raise_for_status.side_effect = HTTPError() response.raise_for_status.side_effect = HTTPError()
results = tineye.response(response) results = self.tineye.response(response)
self.assertEqual(0, len(results)) self.assertEqual(0, len(results))
def test_logs_format_for_422(self): def test_logs_format_for_422(self):
@ -39,9 +45,9 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
response.status_code = 422 response.status_code = 422
response.raise_for_status.side_effect = HTTPError() response.raise_for_status.side_effect = HTTPError()
with self.assertLogs(tineye.logger) as assert_logs_context: with self.assertLogs(self.tineye.logger) as assert_logs_context:
tineye.response(response) self.tineye.response(response)
self.assertIn(tineye.FORMAT_NOT_SUPPORTED, ','.join(assert_logs_context.output)) self.assertIn(self.tineye.FORMAT_NOT_SUPPORTED, ','.join(assert_logs_context.output))
def test_logs_signature_for_422(self): def test_logs_signature_for_422(self):
response = Mock() response = Mock()
@ -49,9 +55,9 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
response.status_code = 422 response.status_code = 422
response.raise_for_status.side_effect = HTTPError() response.raise_for_status.side_effect = HTTPError()
with self.assertLogs(tineye.logger) as assert_logs_context: with self.assertLogs(self.tineye.logger) as assert_logs_context:
tineye.response(response) self.tineye.response(response)
self.assertIn(tineye.NO_SIGNATURE_ERROR, ','.join(assert_logs_context.output)) self.assertIn(self.tineye.NO_SIGNATURE_ERROR, ','.join(assert_logs_context.output))
def test_logs_download_for_422(self): def test_logs_download_for_422(self):
response = Mock() response = Mock()
@ -59,9 +65,9 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
response.status_code = 422 response.status_code = 422
response.raise_for_status.side_effect = HTTPError() response.raise_for_status.side_effect = HTTPError()
with self.assertLogs(tineye.logger) as assert_logs_context: with self.assertLogs(self.tineye.logger) as assert_logs_context:
tineye.response(response) self.tineye.response(response)
self.assertIn(tineye.DOWNLOAD_ERROR, ','.join(assert_logs_context.output)) self.assertIn(self.tineye.DOWNLOAD_ERROR, ','.join(assert_logs_context.output))
def test_logs_description_for_400(self): def test_logs_description_for_400(self):
description = 'There was a problem with that request. Error ID: ad5fc955-a934-43c1-8187-f9a61d301645' description = 'There was a problem with that request. Error ID: ad5fc955-a934-43c1-8187-f9a61d301645'
@ -70,8 +76,8 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
response.status_code = 400 response.status_code = 400
response.raise_for_status.side_effect = HTTPError() response.raise_for_status.side_effect = HTTPError()
with self.assertLogs(tineye.logger) as assert_logs_context: with self.assertLogs(self.tineye.logger) as assert_logs_context:
tineye.response(response) self.tineye.response(response)
self.assertIn(description, ','.join(assert_logs_context.output)) self.assertIn(description, ','.join(assert_logs_context.output))
def test_crawl_date_parses(self): def test_crawl_date_parses(self):
@ -90,5 +96,5 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
] ]
} }
response.status_code = 200 response.status_code = 200
results = tineye.response(response) results = self.tineye.response(response)
self.assertEqual(date, results[0]['publishedDate']) self.assertEqual(date, results[0]['publishedDate'])

View File

@ -2,7 +2,7 @@
# pylint: disable=missing-module-docstring # pylint: disable=missing-module-docstring
from parameterized.parameterized import parameterized from parameterized.parameterized import parameterized
from searx.engines import load_engines import searx.search
from searx.query import RawTextQuery from searx.query import RawTextQuery
from tests import SearxTestCase from tests import SearxTestCase
@ -218,10 +218,10 @@ class TestBang(SearxTestCase): # pylint:disable=missing-class-docstring
THE_QUERY = 'the query' THE_QUERY = 'the query'
def setUp(self): def setUp(self):
load_engines(TEST_ENGINES) searx.search.initialize(TEST_ENGINES)
def tearDown(self): def tearDown(self):
load_engines([]) searx.search.load_engines([])
@parameterized.expand(SPECIFIC_BANGS) @parameterized.expand(SPECIFIC_BANGS)
def test_bang(self, bang: str): def test_bang(self, bang: str):

View File

@ -2,9 +2,26 @@
# pylint: disable=missing-module-docstring # pylint: disable=missing-module-docstring
from searx.results import ResultContainer from searx.results import ResultContainer
import searx.search
from tests import SearxTestCase from tests import SearxTestCase
def make_test_engine_dict(**kwargs) -> dict:
test_engine = {
# fmt: off
'name': None,
'engine': None,
'categories': 'general',
'shortcut': 'dummy',
'timeout': 3.0,
'tokens': [],
# fmt: on
}
test_engine.update(**kwargs)
return test_engine
def fake_result(url='https://aa.bb/cc?dd=ee#ff', title='aaa', content='bbb', engine='wikipedia', **kwargs): def fake_result(url='https://aa.bb/cc?dd=ee#ff', title='aaa', content='bbb', engine='wikipedia', **kwargs):
result = { result = {
# fmt: off # fmt: off
@ -19,23 +36,40 @@ def fake_result(url='https://aa.bb/cc?dd=ee#ff', title='aaa', content='bbb', eng
class ResultContainerTestCase(SearxTestCase): # pylint: disable=missing-class-docstring class ResultContainerTestCase(SearxTestCase): # pylint: disable=missing-class-docstring
def setUp(self) -> None:
stract_engine = make_test_engine_dict(name="stract", engine="stract", shortcut="stra")
duckduckgo_engine = make_test_engine_dict(name="duckduckgo", engine="duckduckgo", shortcut="ddg")
mojeek_engine = make_test_engine_dict(name="mojeek", engine="mojeek", shortcut="mjk")
searx.search.initialize([stract_engine, duckduckgo_engine, mojeek_engine])
self.container = ResultContainer()
def tearDown(self):
searx.search.load_engines([])
def test_empty(self): def test_empty(self):
c = ResultContainer() self.assertEqual(self.container.get_ordered_results(), [])
self.assertEqual(c.get_ordered_results(), [])
def test_one_result(self): def test_one_result(self):
c = ResultContainer() self.container.extend('wikipedia', [fake_result()])
c.extend('wikipedia', [fake_result()])
self.assertEqual(c.results_length(), 1) self.assertEqual(self.container.results_length(), 1)
def test_one_suggestion(self): def test_one_suggestion(self):
c = ResultContainer() self.container.extend('wikipedia', [fake_result(suggestion=True)])
c.extend('wikipedia', [fake_result(suggestion=True)])
self.assertEqual(len(c.suggestions), 1) self.assertEqual(len(self.container.suggestions), 1)
self.assertEqual(c.results_length(), 0) self.assertEqual(self.container.results_length(), 0)
def test_result_merge(self): def test_result_merge(self):
c = ResultContainer() self.container.extend('wikipedia', [fake_result()])
c.extend('wikipedia', [fake_result()]) self.container.extend('wikidata', [fake_result(), fake_result(url='https://example.com/')])
c.extend('wikidata', [fake_result(), fake_result(url='https://example.com/')])
self.assertEqual(c.results_length(), 2) self.assertEqual(self.container.results_length(), 2)
def test_result_merge_by_title(self):
self.container.extend('stract', [fake_result(engine='stract', title='short title')])
self.container.extend('duckduckgo', [fake_result(engine='duckduckgo', title='normal title')])
self.container.extend('mojeek', [fake_result(engine='mojeek', title='this long long title')])
self.assertEqual(self.container.get_ordered_results()[0].get('title', ''), 'this long long title')