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",