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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['images']
 
bool paging = True
 
int nb_per_page = 20
 
str base_url = 'https://api.openverse.engineering/v1/images/'
 
str search_string = '?page={page}&page_size={nb_per_page}&format=json&{query}'
 

Detailed Description

 Openverse (formerly known as: Creative Commons search engine) [Images]

Function Documentation

◆ request()

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

Definition at line 30 of file openverse.py.

30def request(query, params):
31
32 search_path = search_string.format(query=urlencode({'q': query}), nb_per_page=nb_per_page, page=params['pageno'])
33
34 params['url'] = base_url + search_path
35
36 return params
37
38

◆ response()

searx.engines.openverse.response ( resp)

Definition at line 39 of file openverse.py.

39def response(resp):
40 results = []
41
42 json_data = loads(resp.text)
43
44 for result in json_data['results']:
45 results.append(
46 {
47 'url': result['foreign_landing_url'],
48 'title': result['title'],
49 'img_src': result['url'],
50 'template': 'images.html',
51 }
52 )
53
54 return results

Variable Documentation

◆ about

dict searx.engines.openverse.about
Initial value:
1= {
2 "website": 'https://wordpress.org/openverse/',
3 "wikidata_id": None,
4 "official_api_documentation": 'https://api.openverse.engineering/v1/',
5 "use_official_api": True,
6 "require_api_key": False,
7 "results": 'JSON',
8}

Definition at line 12 of file openverse.py.

◆ base_url

str searx.engines.openverse.base_url = 'https://api.openverse.engineering/v1/images/'

Definition at line 26 of file openverse.py.

◆ categories

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

Definition at line 21 of file openverse.py.

◆ nb_per_page

int searx.engines.openverse.nb_per_page = 20

Definition at line 24 of file openverse.py.

◆ paging

bool searx.engines.openverse.paging = True

Definition at line 23 of file openverse.py.

◆ search_string

str searx.engines.openverse.search_string = '?page={page}&page_size={nb_per_page}&format=json&{query}'

Definition at line 27 of file openverse.py.