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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['general']
 
bool paging = False
 
int number_of_results = 5
 
str base_url = 'http://localhost:8090'
 
tuple search_url
 

Detailed Description

 Doku Wiki

Function Documentation

◆ request()

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

Definition at line 39 of file doku.py.

39def request(query, params):
40
41 params['url'] = base_url + search_url.format(query=urlencode({'id': query}))
42
43 return params
44
45
46# get response from search-request

◆ response()

searx.engines.doku.response ( resp)

Definition at line 47 of file doku.py.

47def response(resp):
48 results = []
49
50 doc = fromstring(resp.text)
51
52 # parse results
53 # Quickhits
54 for r in eval_xpath(doc, '//div[@class="search_quickresult"]/ul/li'):
55 try:
56 res_url = eval_xpath(r, './/a[@class="wikilink1"]/@href')[-1]
57 except: # pylint: disable=bare-except
58 continue
59
60 if not res_url:
61 continue
62
63 title = extract_text(eval_xpath(r, './/a[@class="wikilink1"]/@title'))
64
65 # append result
66 results.append({'title': title, 'content': "", 'url': base_url + res_url})
67
68 # Search results
69 for r in eval_xpath(doc, '//dl[@class="search_results"]/*'):
70 try:
71 if r.tag == "dt":
72 res_url = eval_xpath(r, './/a[@class="wikilink1"]/@href')[-1]
73 title = extract_text(eval_xpath(r, './/a[@class="wikilink1"]/@title'))
74 elif r.tag == "dd":
75 content = extract_text(eval_xpath(r, '.'))
76
77 # append result
78 results.append({'title': title, 'content': content, 'url': base_url + res_url})
79 except: # pylint: disable=bare-except
80 continue
81
82 if not res_url:
83 continue
84
85 # return results
86 return results

Variable Documentation

◆ about

dict searx.engines.doku.about
Initial value:
1= {
2 "website": 'https://www.dokuwiki.org/',
3 "wikidata_id": 'Q851864',
4 "official_api_documentation": 'https://www.dokuwiki.org/devel:xmlrpc',
5 "use_official_api": False,
6 "require_api_key": False,
7 "results": 'HTML',
8}

Definition at line 11 of file doku.py.

◆ base_url

str searx.engines.doku.base_url = 'http://localhost:8090'

Definition at line 27 of file doku.py.

◆ categories

list searx.engines.doku.categories = ['general']

Definition at line 21 of file doku.py.

◆ number_of_results

int searx.engines.doku.number_of_results = 5

Definition at line 23 of file doku.py.

◆ paging

bool searx.engines.doku.paging = False

Definition at line 22 of file doku.py.

◆ search_url

tuple searx.engines.doku.search_url
Initial value:
1= (
2 # fmt: off
3 '/?do=search'
4 '&{query}'
5 # fmt: on
6)

Definition at line 28 of file doku.py.