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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = []
 
bool paging = True
 
str base_url = "https://www.destatis.de"
 
str search_url = f"{base_url}/SiteGlobals/Forms/Suche/Expertensuche_Formular.html"
 
str results_xpath = '//div[contains(@class, "l-content-wrapper")]/div[contains(@class, "row")]/div[contains(@class, "column")]/div[contains(@class, "c-result"){extra}]'
 
str results_xpath_filter_recommended = " and not(contains(@class, 'c-result--recommended'))"
 
str url_xpath = './/a/@href'
 
str title_xpath = './/a/text()'
 
str date_xpath = './/a/span[contains(@class, "c-result__date")]'
 
str content_xpath = './/div[contains(@class, "column")]/p/text()'
 
str doctype_xpath = './/div[contains(@class, "c-result__doctype")]/p'
 

Detailed Description

DeStatis

Function Documentation

◆ request()

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

Definition at line 34 of file destatis.py.

34def request(query, params):
35 args = {
36 'templateQueryString': query,
37 'gtp': f"474_list%3D{params['pageno']}",
38 }
39 params['url'] = f"{search_url}?{urlencode(args)}"
40 return params
41
42

◆ response()

searx.engines.destatis.response ( resp)

Definition at line 43 of file destatis.py.

43def response(resp):
44 results = []
45
46 dom = html.fromstring(resp.text)
47
48 # filter out suggested results on further page because they're the same on each page
49 extra_xpath = results_xpath_filter_recommended if resp.search_params['pageno'] > 1 else ''
50 res_xpath = results_xpath.format(extra=extra_xpath)
51
52 for result in eval_xpath_list(dom, res_xpath):
53 doctype = extract_text(eval_xpath(result, doctype_xpath))
54 date = extract_text(eval_xpath(result, date_xpath))
55
56 metadata = [meta for meta in (doctype, date) if meta != ""]
57
58 results.append(
59 {
60 'url': base_url + "/" + extract_text(eval_xpath(result, url_xpath)),
61 'title': extract_text(eval_xpath(result, title_xpath)),
62 'content': extract_text(eval_xpath(result, content_xpath)),
63 'metadata': ', '.join(metadata),
64 }
65 )
66
67 return results

Variable Documentation

◆ about

dict searx.engines.destatis.about
Initial value:
1= {
2 'website': 'https://www.destatis.de',
3 'official_api_documentation': 'https://destatis.api.bund.dev/',
4 'use_official_api': False,
5 'require_api_key': False,
6 'results': 'HTML',
7 'language': 'de',
8}

Definition at line 9 of file destatis.py.

◆ base_url

str searx.engines.destatis.base_url = "https://www.destatis.de"

Definition at line 21 of file destatis.py.

◆ categories

list searx.engines.destatis.categories = []

Definition at line 18 of file destatis.py.

◆ content_xpath

str searx.engines.destatis.content_xpath = './/div[contains(@class, "column")]/p/text()'

Definition at line 30 of file destatis.py.

◆ date_xpath

str searx.engines.destatis.date_xpath = './/a/span[contains(@class, "c-result__date")]'

Definition at line 29 of file destatis.py.

◆ doctype_xpath

str searx.engines.destatis.doctype_xpath = './/div[contains(@class, "c-result__doctype")]/p'

Definition at line 31 of file destatis.py.

◆ paging

bool searx.engines.destatis.paging = True

Definition at line 19 of file destatis.py.

◆ results_xpath

str searx.engines.destatis.results_xpath = '//div[contains(@class, "l-content-wrapper")]/div[contains(@class, "row")]/div[contains(@class, "column")]/div[contains(@class, "c-result"){extra}]'

Definition at line 25 of file destatis.py.

◆ results_xpath_filter_recommended

str searx.engines.destatis.results_xpath_filter_recommended = " and not(contains(@class, 'c-result--recommended'))"

Definition at line 26 of file destatis.py.

◆ search_url

str searx.engines.destatis.search_url = f"{base_url}/SiteGlobals/Forms/Suche/Expertensuche_Formular.html"

Definition at line 22 of file destatis.py.

◆ title_xpath

str searx.engines.destatis.title_xpath = './/a/text()'

Definition at line 28 of file destatis.py.

◆ url_xpath

str searx.engines.destatis.url_xpath = './/a/@href'

Definition at line 27 of file destatis.py.