mirror of
https://github.com/searxng/searxng.git
synced 2025-11-27 00:35:06 -05:00
[mod] yandex engine: add supported languages
Add support for Yandex's supported languages; Russian, English, Belarusian, French, German, Indonesian, Kazakh, Tatar, Turkish and Ukrainian.
This commit is contained in:
parent
2313b972a3
commit
bcc7a5eb2e
@ -28,6 +28,20 @@ search_type = ""
|
|||||||
base_url_web = 'https://yandex.com/search/site/'
|
base_url_web = 'https://yandex.com/search/site/'
|
||||||
base_url_images = 'https://yandex.com/images/search'
|
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")]'
|
results_xpath = '//li[contains(@class, "serp-item")]'
|
||||||
url_xpath = './/a[@class="b-serp-item__title-link"]/@href'
|
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'
|
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",
|
"searchid": "3131712",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lang = params["language"].split("-")[0]
|
||||||
|
if lang in yandex_supported_langs:
|
||||||
|
query_params_web["lang"] = lang
|
||||||
|
|
||||||
query_params_images = {
|
query_params_images = {
|
||||||
"text": query,
|
"text": query,
|
||||||
"uinfo": "sw-1920-sh-1080-ww-1125-wh-999",
|
"uinfo": "sw-1920-sh-1080-ww-1125-wh-999",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user