mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
[chore] drop lingva engine / lingva-translate no onger maintained
The lingva-translate seems to be dead. Even the instances specified in the README [1] have not been updated for 12 months and no longer correspond to the current status, for example https://translate.projectsegfau.lt/ has already switched to Mozhi. The official instance lingva.ml keeps failing [2] and seems to me to have a different interface than we have implemented in the engine. Somehow it all seems to be a bit of a mess, I can't think of any other solution than to take the engine out of SearXNG for the time being (unfortunately). [1] https://github.com/thedaviddelta/lingva-translate/blob/main/README.md#instances [2] https://github.com/thedaviddelta/lingva-translate/issues/184#issuecomment-2461363898 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
342d321196
commit
63ec9058c9
2 changed files with 0 additions and 71 deletions
|
@ -1,65 +0,0 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
"""Lingva (alternative Google Translate frontend)"""
|
|
||||||
|
|
||||||
from json import loads
|
|
||||||
|
|
||||||
about = {
|
|
||||||
"website": 'https://lingva.ml',
|
|
||||||
"wikidata_id": None,
|
|
||||||
"official_api_documentation": 'https://github.com/thedaviddelta/lingva-translate#public-apis',
|
|
||||||
"use_official_api": True,
|
|
||||||
"require_api_key": False,
|
|
||||||
"results": 'JSON',
|
|
||||||
}
|
|
||||||
|
|
||||||
engine_type = 'online_dictionary'
|
|
||||||
categories = ['general', 'translate']
|
|
||||||
|
|
||||||
url = "https://lingva.thedaviddelta.com"
|
|
||||||
search_url = "{url}/api/v1/{from_lang}/{to_lang}/{query}"
|
|
||||||
|
|
||||||
|
|
||||||
def request(_query, params):
|
|
||||||
params['url'] = search_url.format(
|
|
||||||
url=url, from_lang=params['from_lang'][1], to_lang=params['to_lang'][1], query=params['query']
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
|
|
||||||
|
|
||||||
def response(resp):
|
|
||||||
results = []
|
|
||||||
|
|
||||||
result = loads(resp.text)
|
|
||||||
info = result["info"]
|
|
||||||
from_to_prefix = "%s-%s " % (resp.search_params['from_lang'][1], resp.search_params['to_lang'][1])
|
|
||||||
|
|
||||||
if "typo" in info:
|
|
||||||
results.append({"suggestion": from_to_prefix + info["typo"]})
|
|
||||||
|
|
||||||
if 'definitions' in info: # pylint: disable=too-many-nested-blocks
|
|
||||||
for definition in info['definitions']:
|
|
||||||
if 'list' in definition:
|
|
||||||
for item in definition['list']:
|
|
||||||
if 'synonyms' in item:
|
|
||||||
for synonym in item['synonyms']:
|
|
||||||
results.append({"suggestion": from_to_prefix + synonym})
|
|
||||||
|
|
||||||
infobox = ""
|
|
||||||
|
|
||||||
for translation in info["extraTranslations"]:
|
|
||||||
for word in translation["list"]:
|
|
||||||
infobox += f"<dl><dt>{word['word']}</dt>"
|
|
||||||
|
|
||||||
for meaning in word["meanings"]:
|
|
||||||
infobox += f"<dd>{meaning}</dd>"
|
|
||||||
|
|
||||||
infobox += "</dl>"
|
|
||||||
|
|
||||||
results.append(
|
|
||||||
{
|
|
||||||
'infobox': result["translation"],
|
|
||||||
'content': infobox,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
return results
|
|
|
@ -1121,12 +1121,6 @@ engines:
|
||||||
shortcut: lt
|
shortcut: lt
|
||||||
disabled: true
|
disabled: true
|
||||||
|
|
||||||
- name: lingva
|
|
||||||
engine: lingva
|
|
||||||
shortcut: lv
|
|
||||||
# set lingva instance in url, by default it will use the official instance
|
|
||||||
# url: https://lingva.thedaviddelta.com
|
|
||||||
|
|
||||||
- name: lobste.rs
|
- name: lobste.rs
|
||||||
engine: xpath
|
engine: xpath
|
||||||
search_url: https://lobste.rs/search?q={query}&what=stories&order=relevance
|
search_url: https://lobste.rs/search?q={query}&what=stories&order=relevance
|
||||||
|
|
Loading…
Add table
Reference in a new issue