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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['music']
 
bool paging = True
 
str url = 'https://music.yandex.ru'
 
str search_url = url + '/handlers/music-search.jsx'
 

Detailed Description

Yandex Music

.. _Countries where Yandex.Music is available: https://yandex.com/support/music/access.html

.. hint::

   Access to music is limited to a few countries: `Countries where Yandex.Music
   is available`_

Function Documentation

◆ request()

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

Definition at line 35 of file yandex_music.py.

35def request(query, params):
36 args = {'text': query, 'page': params['pageno'] - 1}
37 params['url'] = search_url + '?' + urlencode(args)
38
39 return params
40
41
42# get response from search-request

◆ response()

searx.engines.yandex_music.response ( resp)

Definition at line 43 of file yandex_music.py.

43def response(resp):
44 results = []
45 search_res = resp.json()
46
47 # parse results
48 for result in search_res.get('tracks', {}).get('items', []):
49 if result['type'] == 'music':
50 track_id = result['id']
51 album_id = result['albums'][0]['id']
52
53 # append result
54 results.append(
55 {
56 'url': f'{url}/album/{album_id}/track/{track_id}',
57 'title': result['title'],
58 'content': f"[{result['albums'][0]['title']}] {result['artists'][0]['name']} - {result['title']}",
59 'iframe_src': f'{url}/iframe/track/{track_id}/{album_id}',
60 }
61 )
62
63 return results

Variable Documentation

◆ about

dict searx.engines.yandex_music.about
Initial value:
1= {
2 "website": 'https://music.yandex.ru',
3 "wikidata_id": 'Q4537983',
4 "official_api_documentation": None,
5 "use_official_api": False,
6 "require_api_key": False,
7 "results": 'JSON',
8}

Definition at line 16 of file yandex_music.py.

◆ categories

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

Definition at line 26 of file yandex_music.py.

◆ paging

bool searx.engines.yandex_music.paging = True

Definition at line 27 of file yandex_music.py.

◆ search_url

str searx.engines.yandex_music.search_url = url + '/handlers/music-search.jsx'

Definition at line 31 of file yandex_music.py.

◆ url

str searx.engines.yandex_music.url = 'https://music.yandex.ru'

Definition at line 30 of file yandex_music.py.