diff options
author | Alexandre Flament <alex@al-f.net> | 2020-12-16 16:20:03 +0100 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2020-12-17 11:39:36 +0100 |
commit | 02fc4147ce745325ff25146a8085a915a5d3cacd (patch) | |
tree | c1e7b116220d72f9e541ff4e7e5b108dd8a2f2aa /searx/engines/dictzone.py | |
parent | 7ec8bc3ea76516e33318c67165161df5c1efdd36 (diff) | |
download | searxng-02fc4147ce745325ff25146a8085a915a5d3cacd.tar.gz searxng-02fc4147ce745325ff25146a8085a915a5d3cacd.zip |
[mod] dictzone, translated, currency_convert: use engine_type online_curency and online_dictionnary
Diffstat (limited to 'searx/engines/dictzone.py')
-rw-r--r-- | searx/engines/dictzone.py | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/searx/engines/dictzone.py b/searx/engines/dictzone.py index 727eb6598..5e6f688a1 100644 --- a/searx/engines/dictzone.py +++ b/searx/engines/dictzone.py @@ -9,36 +9,24 @@ @parse url, title, content """ -import re from urllib.parse import urljoin from lxml import html -from searx.utils import is_valid_lang, eval_xpath +from searx.utils import eval_xpath + +engine_type = 'online_dictionnary' categories = ['general'] url = 'https://dictzone.com/{from_lang}-{to_lang}-dictionary/{query}' weight = 100 -parser_re = re.compile('.*?([a-z]+)-([a-z]+) ([^ ]+)$', re.I) results_xpath = './/table[@id="r"]/tr' https_support = True def request(query, params): - m = parser_re.match(query) - if not m: - return params - - from_lang, to_lang, query = m.groups() - - from_lang = is_valid_lang(from_lang) - to_lang = is_valid_lang(to_lang) - - if not from_lang or not to_lang: - return params - - params['url'] = url.format(from_lang=from_lang[2], - to_lang=to_lang[2], - query=query) + params['url'] = url.format(from_lang=params['from_lang'][2], + to_lang=params['to_lang'][2], + query=params['query']) return params |