mirror of
https://github.com/searx/searx
synced 2025-02-08 07:58:51 +01:00
Fix online dictionaries
This commit is contained in:
parent
05fe2ee093
commit
54697a8705
@ -17,7 +17,7 @@ about = {
|
|||||||
"results": 'HTML',
|
"results": 'HTML',
|
||||||
}
|
}
|
||||||
|
|
||||||
engine_type = 'online_dictionnary'
|
engine_type = 'online_dictionary'
|
||||||
categories = ['general']
|
categories = ['general']
|
||||||
url = 'https://dictzone.com/{from_lang}-{to_lang}-dictionary/{query}'
|
url = 'https://dictzone.com/{from_lang}-{to_lang}-dictionary/{query}'
|
||||||
weight = 100
|
weight = 100
|
||||||
@ -27,9 +27,7 @@ https_support = True
|
|||||||
|
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
params['url'] = url.format(from_lang=params['from_lang'][2],
|
params['url'] = url.format(from_lang=params['from_lang'][2], to_lang=params['to_lang'][2], query=params['query'])
|
||||||
to_lang=params['to_lang'][2],
|
|
||||||
query=params['query'])
|
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
@ -51,10 +49,12 @@ def response(resp):
|
|||||||
if t.strip():
|
if t.strip():
|
||||||
to_results.append(to_result.text_content())
|
to_results.append(to_result.text_content())
|
||||||
|
|
||||||
results.append({
|
results.append(
|
||||||
'url': urljoin(resp.url, '?%d' % k),
|
{
|
||||||
|
'url': urljoin(str(resp.url), '?%d' % k),
|
||||||
'title': from_result.text_content(),
|
'title': from_result.text_content(),
|
||||||
'content': '; '.join(to_results)
|
'content': '; '.join(to_results),
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
@ -5,13 +5,12 @@ import re
|
|||||||
from searx.utils import is_valid_lang
|
from searx.utils import is_valid_lang
|
||||||
from .online import OnlineProcessor
|
from .online import OnlineProcessor
|
||||||
|
|
||||||
|
parser_re = re.compile('.*?([a-z]+)-([a-z]+) (.+)$', re.I)
|
||||||
parser_re = re.compile('.*?([a-z]+)-([a-z]+) ([^ ]+)$', re.I)
|
|
||||||
|
|
||||||
|
|
||||||
class OnlineDictionaryProcessor(OnlineProcessor):
|
class OnlineDictionaryProcessor(OnlineProcessor):
|
||||||
|
|
||||||
engine_type = 'online_dictionnary'
|
engine_type = 'online_dictionary'
|
||||||
|
|
||||||
def get_params(self, search_query, engine_category):
|
def get_params(self, search_query, engine_category):
|
||||||
params = super().get_params(search_query, engine_category)
|
params = super().get_params(search_query, engine_category)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user