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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['music']
 
bool paging = True
 
str url = 'https://api.deezer.com/'
 
str search_url = url + 'search?{query}&index={offset}'
 
str iframe_src = "https://www.deezer.com/plugins/player?type=tracks&id={audioid}"
 

Detailed Description

 Deezer (Music)

Function Documentation

◆ request()

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

Definition at line 30 of file deezer.py.

30def request(query, params):
31 offset = (params['pageno'] - 1) * 25
32
33 params['url'] = search_url.format(query=urlencode({'q': query}), offset=offset)
34
35 return params
36
37
38# get response from search-request

◆ response()

searx.engines.deezer.response ( resp)

Definition at line 39 of file deezer.py.

39def response(resp):
40 results = []
41
42 search_res = loads(resp.text)
43
44 # parse results
45 for result in search_res.get('data', []):
46 if result['type'] == 'track':
47 title = result['title']
48 url = result['link'] # pylint: disable=redefined-outer-name
49
50 if url.startswith('http://'):
51 url = 'https' + url[4:]
52
53 content = '{} - {} - {}'.format(result['artist']['name'], result['album']['title'], result['title'])
54
55 # append result
56 results.append(
57 {'url': url, 'title': title, 'iframe_src': iframe_src.format(audioid=result['id']), 'content': content}
58 )
59
60 # return results
61 return results

References searx.format.

Variable Documentation

◆ about

dict searx.engines.deezer.about
Initial value:
1= {
2 "website": 'https://deezer.com',
3 "wikidata_id": 'Q602243',
4 "official_api_documentation": 'https://developers.deezer.com/',
5 "use_official_api": True,
6 "require_api_key": False,
7 "results": 'JSON',
8}

Definition at line 10 of file deezer.py.

◆ categories

list searx.engines.deezer.categories = ['music']

Definition at line 20 of file deezer.py.

◆ iframe_src

str searx.engines.deezer.iframe_src = "https://www.deezer.com/plugins/player?type=tracks&id={audioid}"

Definition at line 26 of file deezer.py.

◆ paging

bool searx.engines.deezer.paging = True

Definition at line 21 of file deezer.py.

◆ search_url

str searx.engines.deezer.search_url = url + 'search?{query}&index={offset}'

Definition at line 25 of file deezer.py.

◆ url

str searx.engines.deezer.url = 'https://api.deezer.com/'

Definition at line 24 of file deezer.py.