mirror of
https://github.com/searxng/searxng.git
synced 2026-08-12 02:01:36 +00:00
Compare commits
2 Commits
4fa7de8033
...
230215c250
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
230215c250 | ||
|
|
1ef5c03962 |
@@ -372,8 +372,9 @@ def response(resp) -> EngineResults:
|
|||||||
continue
|
continue
|
||||||
item["title"] = extract_text(title)
|
item["title"] = extract_text(title)
|
||||||
item["url"] = eval_xpath(div_result, './/h2/a/@href')[0]
|
item["url"] = eval_xpath(div_result, './/h2/a/@href')[0]
|
||||||
item["content"] = extract_text(eval_xpath(div_result, './/a[contains(@class, "result__snippet")]')[0])
|
item["content"] = extract_text(
|
||||||
|
eval_xpath_getindex(div_result, './/a[contains(@class, "result__snippet")]', 0, [])
|
||||||
|
)
|
||||||
results.append(item)
|
results.append(item)
|
||||||
|
|
||||||
zero_click_info_xpath = '//div[@id="zero_click_abstract"]'
|
zero_click_info_xpath = '//div[@id="zero_click_abstract"]'
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ from searx.metrics import get_engines_stats, get_engine_errors, get_reliabilitie
|
|||||||
from searx.flaskfix import patch_application
|
from searx.flaskfix import patch_application
|
||||||
|
|
||||||
from searx.locales import (
|
from searx.locales import (
|
||||||
|
LOCALE_BEST_MATCH,
|
||||||
LOCALE_NAMES,
|
LOCALE_NAMES,
|
||||||
RTL_LOCALES,
|
RTL_LOCALES,
|
||||||
localeselector,
|
localeselector,
|
||||||
@@ -1059,10 +1060,12 @@ def image_proxy():
|
|||||||
|
|
||||||
@app.route('/engine_descriptions.json', methods=['GET'])
|
@app.route('/engine_descriptions.json', methods=['GET'])
|
||||||
def engine_descriptions():
|
def engine_descriptions():
|
||||||
locale = get_locale().split('_')[0]
|
sxng_ui_lang_tag = get_locale().replace("_", "-")
|
||||||
|
sxng_ui_lang_tag = LOCALE_BEST_MATCH.get(sxng_ui_lang_tag, sxng_ui_lang_tag)
|
||||||
|
|
||||||
result = ENGINE_DESCRIPTIONS['en'].copy()
|
result = ENGINE_DESCRIPTIONS['en'].copy()
|
||||||
if locale != 'en':
|
if sxng_ui_lang_tag != 'en':
|
||||||
for engine, description in ENGINE_DESCRIPTIONS.get(locale, {}).items():
|
for engine, description in ENGINE_DESCRIPTIONS.get(sxng_ui_lang_tag, {}).items():
|
||||||
result[engine] = description
|
result[engine] = description
|
||||||
for engine, description in result.items():
|
for engine, description in result.items():
|
||||||
if len(description) == 2 and description[1] == 'ref':
|
if len(description) == 2 and description[1] == 'ref':
|
||||||
|
|||||||
Reference in New Issue
Block a user