From 7adb9090e5dbc25b0d120772beca01dc4eb0791e Mon Sep 17 00:00:00 2001 From: Paolo Basso <12545838+paolobasso99@users.noreply.github.com> Date: Sun, 25 Jun 2023 17:24:28 +0200 Subject: [PATCH] [mod] engine: Anna's Archive - add language support --- searx/engines/{annas-archive.py => annas_archive.py} | 9 +++++++-- searx/settings.yml | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) rename searx/engines/{annas-archive.py => annas_archive.py} (87%) diff --git a/searx/engines/annas-archive.py b/searx/engines/annas_archive.py similarity index 87% rename from searx/engines/annas-archive.py rename to searx/engines/annas_archive.py index 56d1ca77a..1d5aa41ee 100644 --- a/searx/engines/annas-archive.py +++ b/searx/engines/annas_archive.py @@ -36,8 +36,13 @@ xpath_file_info: str = './/div[contains(@class, "text-xs")]' def request(query, params: Dict[str, Any]) -> Dict[str, Any]: - search_url: str = base_url + "/search?q={search_query}" - params["url"] = search_url.format(search_query=quote(query)) + search_url: str = base_url + "/search?q={search_query}&lang={lang}" + lang: str = "" + if params["language"] != "all": + lang = params["language"] + + params["url"] = search_url.format(search_query=quote(query), lang=lang) + print(params) return params diff --git a/searx/settings.yml b/searx/settings.yml index 561ec41a9..8877fba54 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -298,8 +298,8 @@ engines: disabled: true - name: anna's archive - engine: annas-archive - paging: False + engine: annas_archive + paging: false categories: files disabled: true shortcut: aa