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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
bool paging = True
 
list categories = ['packages', 'it']
 
str base_url = "https://pkgs.alpinelinux.org"
 
str alpine_arch = 'x86_64'
 
 ARCH_RE = re.compile("x86_64|x86|aarch64|armhf|ppc64le|s390x|armv7|riscv64")
 

Detailed Description

`Alpine Linux binary packages`_.  `Alpine Linux`_ is a Linux-based operation
system designed to be small, simple and secure.  Contrary to many other Linux
distributions, it uses musl, BusyBox and OpenRC.  Alpine is mostly used on
servers and for Docker images.

.. _Alpine Linux binary packages: https://pkgs.alpinelinux.org
.. _Alpine Linux: https://www.alpinelinux.org

Function Documentation

◆ request()

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

Definition at line 40 of file alpinelinux.py.

40def request(query, params):
41 query_arch = ARCH_RE.search(query)
42 if query_arch:
43 query_arch = query_arch.group(0)
44 query = query.replace(query_arch, '').strip()
45
46 args = {
47 # use wildcards to match more than just packages with the exact same
48 # name as the query
49 'name': f"*{query}*",
50 'page': params['pageno'],
51 'arch': query_arch or alpine_arch,
52 }
53 params['url'] = f"{base_url}/packages?{urlencode(args)}"
54 return params
55
56

◆ response()

searx.engines.alpinelinux.response ( resp)

Definition at line 57 of file alpinelinux.py.

57def response(resp):
58 results = []
59
60 doc = html.fromstring(resp.text)
61 for result in eval_xpath_list(doc, "//table/tbody/tr"):
62
63 if len(result.xpath("./td")) < 9:
64 # skip non valid entries in the result table
65 # e.g the "No item found..." message
66 continue
67
68 results.append(
69 {
70 'template': 'packages.html',
71 'url': base_url + extract_text(eval_xpath(result, './td[contains(@class, "package")]/a/@href')),
72 'title': extract_text(eval_xpath(result, './td[contains(@class, "package")]')),
73 'package_name': extract_text(eval_xpath(result, './td[contains(@class, "package")]')),
74 'publishedDate': parser.parse(extract_text(eval_xpath(result, './td[contains(@class, "bdate")]'))),
75 'version': extract_text(eval_xpath(result, './td[contains(@class, "version")]')),
76 'homepage': extract_text(eval_xpath(result, './td[contains(@class, "url")]/a/@href')),
77 'maintainer': extract_text(eval_xpath(result, './td[contains(@class, "maintainer")]')),
78 'license_name': extract_text(eval_xpath(result, './td[contains(@class, "license")]')),
79 'tags': [extract_text(eval_xpath(result, './td[contains(@class, "repo")]'))],
80 }
81 )
82
83 return results

Variable Documentation

◆ about

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

Definition at line 20 of file alpinelinux.py.

◆ alpine_arch

str searx.engines.alpinelinux.alpine_arch = 'x86_64'

Definition at line 32 of file alpinelinux.py.

◆ ARCH_RE

searx.engines.alpinelinux.ARCH_RE = re.compile("x86_64|x86|aarch64|armhf|ppc64le|s390x|armv7|riscv64")

Definition at line 36 of file alpinelinux.py.

◆ base_url

str searx.engines.alpinelinux.base_url = "https://pkgs.alpinelinux.org"

Definition at line 31 of file alpinelinux.py.

◆ categories

list searx.engines.alpinelinux.categories = ['packages', 'it']

Definition at line 29 of file alpinelinux.py.

◆ paging

bool searx.engines.alpinelinux.paging = True

Definition at line 28 of file alpinelinux.py.