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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ["it", "packages"]
 
str base_url = 'https://lib.rs'
 
str results_xpath = '/html/body/main/div/ol/li/a'
 
str url_xpath = './@href'
 
str title_xpath = './div[@class="h"]/h4'
 
str content_xpath = './div[@class="h"]/p'
 
str version_xpath = './div[@class="meta"]/span[contains(@class, "version")]'
 
str download_count_xpath = './div[@class="meta"]/span[@class="downloads"]'
 
str tags_xpath = './div[@class="meta"]/span[contains(@class, "k")]/text()'
 

Detailed Description

lib.rs (packages)

Function Documentation

◆ request()

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

Definition at line 29 of file lib_rs.py.

29def request(query, params):
30 params['url'] = f"{base_url}/search?q={quote_plus(query)}"
31
32 return params
33
34

◆ response()

searx.engines.lib_rs.response ( resp)

Definition at line 35 of file lib_rs.py.

35def response(resp):
36 results = []
37
38 doc = html.fromstring(resp.text)
39
40 for result in eval_xpath_list(doc, results_xpath):
41 package_name = extract_text(eval_xpath(result, title_xpath))
42 results.append(
43 {
44 'template': 'packages.html',
45 'title': package_name,
46 'url': base_url + extract_text(eval_xpath(result, url_xpath)), # type: ignore
47 'content': extract_text(eval_xpath(result, content_xpath)),
48 'package_name': package_name,
49 'version': extract_text(eval_xpath(result, version_xpath)),
50 'popularity': extract_text(eval_xpath(result, download_count_xpath)),
51 'tags': eval_xpath_list(result, tags_xpath),
52 }
53 )
54
55 return results

Variable Documentation

◆ about

dict searx.engines.lib_rs.about
Initial value:
1= {
2 'website': 'https://lib.rs',
3 'wikidata_id': 'Q113486010',
4 'use_official_api': False,
5 'require_api_key': False,
6 'results': "HTML",
7}

Definition at line 8 of file lib_rs.py.

◆ base_url

str searx.engines.lib_rs.base_url = 'https://lib.rs'

Definition at line 18 of file lib_rs.py.

◆ categories

list searx.engines.lib_rs.categories = ["it", "packages"]

Definition at line 16 of file lib_rs.py.

◆ content_xpath

str searx.engines.lib_rs.content_xpath = './div[@class="h"]/p'

Definition at line 23 of file lib_rs.py.

◆ download_count_xpath

str searx.engines.lib_rs.download_count_xpath = './div[@class="meta"]/span[@class="downloads"]'

Definition at line 25 of file lib_rs.py.

◆ results_xpath

str searx.engines.lib_rs.results_xpath = '/html/body/main/div/ol/li/a'

Definition at line 20 of file lib_rs.py.

◆ tags_xpath

str searx.engines.lib_rs.tags_xpath = './div[@class="meta"]/span[contains(@class, "k")]/text()'

Definition at line 26 of file lib_rs.py.

◆ title_xpath

str searx.engines.lib_rs.title_xpath = './div[@class="h"]/h4'

Definition at line 22 of file lib_rs.py.

◆ url_xpath

str searx.engines.lib_rs.url_xpath = './@href'

Definition at line 21 of file lib_rs.py.

◆ version_xpath

str searx.engines.lib_rs.version_xpath = './div[@class="meta"]/span[contains(@class, "version")]'

Definition at line 24 of file lib_rs.py.