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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['images']
 
str icons_list_url = 'https://cdn.selfh.st/directory/icons.json'
 
str icons_cdn_base_url = 'https://cdn.jsdelivr.net'
 

Detailed Description

selfh.st/icons - A collection of logos for self-hosted dashboards and
documentation

Function Documentation

◆ request()

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

Definition at line 21 of file selfhst.py.

21def request(query, params):
22 params['url'] = icons_list_url
23 params['query'] = query
24 return params
25
26

◆ response()

searx.engines.selfhst.response ( resp)

Definition at line 27 of file selfhst.py.

27def response(resp):
28 results = []
29
30 query_parts = resp.search_params['query'].lower().split(' ')
31 for item in resp.json():
32 keyword = item['Reference'].lower()
33 if not any(query_part in keyword for query_part in query_parts):
34 continue
35
36 img_format = None
37 for format_name in ('SVG', 'PNG', 'WebP'):
38 if item[format_name] == 'Yes':
39 img_format = format_name.lower()
40 break
41
42 img_src = f'{icons_cdn_base_url}/gh/selfhst/icons/{img_format}/{item["Reference"]}.{img_format}'
43 result = {
44 'template': 'images.html',
45 'url': img_src,
46 'title': item['Name'],
47 'content': '',
48 'img_src': img_src,
49 'img_format': img_format,
50 'publishedDate': parser.parse(item['CreatedAt']),
51 }
52 results.append(result)
53
54 return results

Variable Documentation

◆ about

dict searx.engines.selfhst.about
Initial value:
1= {
2 'website': 'https://selfh.st/icons/',
3 'official_api_documentation': 'https://selfh.st/icons-about/',
4 "use_official_api": True,
5 "require_api_key": False,
6 "results": 'JSON',
7}

Definition at line 7 of file selfhst.py.

◆ categories

list searx.engines.selfhst.categories = ['images']

Definition at line 14 of file selfhst.py.

◆ icons_cdn_base_url

str searx.engines.selfhst.icons_cdn_base_url = 'https://cdn.jsdelivr.net'

Definition at line 18 of file selfhst.py.

◆ icons_list_url

str searx.engines.selfhst.icons_list_url = 'https://cdn.selfh.st/directory/icons.json'

Definition at line 17 of file selfhst.py.