.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
cppreference.py
Go to the documentation of this file.
1
# SPDX-License-Identifier: AGPL-3.0-or-later
2
"""Cppreference
3
"""
4
from
lxml
import
html
5
from
searx.utils
import
eval_xpath
6
7
8
about = {
9
"website"
:
"https://en.cppreference.com/"
,
10
"wikidata_id"
:
None
,
11
"official_api_documentation"
:
None
,
12
"use_official_api"
:
False
,
13
"require_api_key"
:
False
,
14
"results"
:
'HTML'
,
15
}
16
17
18
categories = [
'it'
]
19
url =
'https://en.cppreference.com/'
20
search_url = url +
'mwiki/index.php?title=Special%3ASearch&search={query}'
21
22
23
def
request
(query, params):
24
params[
'url'
] = search_url.format(query=query)
25
return
query
26
27
28
def
response
(resp):
29
results = []
30
dom = html.fromstring(resp.text)
31
for
result
in
eval_xpath(dom,
'//div[contains(@class, "mw-search-result-heading")]'
):
32
results.append(
33
{
34
'url'
: url + eval_xpath(result,
'.//a/@href'
)[0],
35
'title'
: eval_xpath(result,
'.//a/text()'
)[0],
36
}
37
)
38
return
results
searx.engines.cppreference.response
response(resp)
Definition
cppreference.py:28
searx.engines.cppreference.request
request(query, params)
Definition
cppreference.py:23
searx.utils
Definition
utils.py:1
searxng
searx
engines
cppreference.py
Generated on Sat Nov 16 2024 00:10:57 for .oO SearXNG Developer Documentation Oo. by
1.12.0