.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.dictzone Namespace Reference

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
str engine_type = 'online_dictionary'
 
list categories = ['general', 'translate']
 
str url = 'https://dictzone.com/{from_lang}-{to_lang}-dictionary/{query}'
 
int weight = 100
 
str results_xpath = './/table[@id="r"]/tr'
 
bool https_support = True
 

Detailed Description

 Dictzone

Function Documentation

◆ request()

searx.engines.dictzone.request ( query,
params )

Definition at line 29 of file dictzone.py.

29def request(query, params): # pylint: disable=unused-argument
30 params['url'] = url.format(from_lang=params['from_lang'][2], to_lang=params['to_lang'][2], query=params['query'])
31
32 return params
33
34

◆ response()

searx.engines.dictzone.response ( resp)

Definition at line 35 of file dictzone.py.

35def response(resp):
36 results = []
37
38 dom = html.fromstring(resp.text)
39
40 for k, result in enumerate(eval_xpath(dom, results_xpath)[1:]):
41 try:
42 from_result, to_results_raw = eval_xpath(result, './td')
43 except: # pylint: disable=bare-except
44 continue
45
46 to_results = []
47 for to_result in eval_xpath(to_results_raw, './p/a'):
48 t = to_result.text_content()
49 if t.strip():
50 to_results.append(to_result.text_content())
51
52 results.append(
53 {
54 'url': urljoin(str(resp.url), '?%d' % k),
55 'title': from_result.text_content(),
56 'content': '; '.join(to_results),
57 }
58 )
59
60 return results

Variable Documentation

◆ about

dict searx.engines.dictzone.about
Initial value:
1= {
2 "website": 'https://dictzone.com/',
3 "wikidata_id": None,
4 "official_api_documentation": None,
5 "use_official_api": False,
6 "require_api_key": False,
7 "results": 'HTML',
8}

Definition at line 11 of file dictzone.py.

◆ categories

list searx.engines.dictzone.categories = ['general', 'translate']

Definition at line 21 of file dictzone.py.

◆ engine_type

str searx.engines.dictzone.engine_type = 'online_dictionary'

Definition at line 20 of file dictzone.py.

◆ https_support

bool searx.engines.dictzone.https_support = True

Definition at line 26 of file dictzone.py.

◆ results_xpath

str searx.engines.dictzone.results_xpath = './/table[@id="r"]/tr'

Definition at line 25 of file dictzone.py.

◆ url

str searx.engines.dictzone.url = 'https://dictzone.com/{from_lang}-{to_lang}-dictionary/{query}'

Definition at line 22 of file dictzone.py.

◆ weight

int searx.engines.dictzone.weight = 100

Definition at line 23 of file dictzone.py.