diff options
| author | Aadniz <8147434+Aadniz@users.noreply.github.com> | 2025-11-06 11:26:19 +0100 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2025-11-25 11:50:18 +0100 |
| commit | bcc7a5eb2ee8b477b25b608313a0e28a3f7cc761 (patch) | |
| tree | 4896e01305a972cfcf908f6f6c5240f81f69c48f | |
| parent | 2313b972a38170df5421839b911f942cb8ea4af3 (diff) | |
[mod] yandex engine: add supported languages
Add support for Yandex's supported languages; Russian, English, Belarusian,
French, German, Indonesian, Kazakh, Tatar, Turkish and Ukrainian.
| -rw-r--r-- | searx/engines/yandex.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/searx/engines/yandex.py b/searx/engines/yandex.py index 77b03067b..84d18ebe3 100644 --- a/searx/engines/yandex.py +++ b/searx/engines/yandex.py @@ -28,6 +28,20 @@ search_type = "" base_url_web = 'https://yandex.com/search/site/' base_url_images = 'https://yandex.com/images/search' +# Supported languages +yandex_supported_langs = [ + "ru", # Russian + "en", # English + "be", # Belarusian + "fr", # French + "de", # German + "id", # Indonesian + "kk", # Kazakh + "tt", # Tatar + "tr", # Turkish + "uk", # Ukrainian +] + results_xpath = '//li[contains(@class, "serp-item")]' url_xpath = './/a[@class="b-serp-item__title-link"]/@href' title_xpath = './/h3[@class="b-serp-item__title"]/a[@class="b-serp-item__title-link"]/span' @@ -48,6 +62,10 @@ def request(query, params): "searchid": "3131712", } + lang = params["language"].split("-")[0] + if lang in yandex_supported_langs: + query_params_web["lang"] = lang + query_params_images = { "text": query, "uinfo": "sw-1920-sh-1080-ww-1125-wh-999", |