diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2022-02-07 21:59:21 +0100 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarit.de> | 2022-02-13 14:20:47 +0100 |
| commit | 98cab4cf754752e8a615b7b6c2685021592889a7 (patch) | |
| tree | 8aac9568766473950db0747cd6a12e1b098384e5 /searx/engines/spotify.py | |
| parent | b9a2e8b387212d35cc83da50a07ee8fa47d2a56e (diff) | |
[mod] result_templates/default.html replace embedded HTML by data_src audio_src
Embedded HTML breaks SearXNG architecture. To modularize, HTML is generated in
the templates (oscar & simple) and result parameter 'embedded' is replaced by
'data_src' (and 'audio_src'), an URL for embedded content (<iframe>).
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/spotify.py')
| -rw-r--r-- | searx/engines/spotify.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/searx/engines/spotify.py b/searx/engines/spotify.py index 15517e3eb..c287a3469 100644 --- a/searx/engines/spotify.py +++ b/searx/engines/spotify.py @@ -29,10 +29,6 @@ api_client_secret = None url = 'https://api.spotify.com/' search_url = url + 'v1/search?{query}&type=track&offset={offset}' -embedded_url = '<iframe data-src="https://embed.spotify.com/?uri=spotify:track:{audioid}"\ - width="300" height="80" frameborder="0" allowtransparency="true"></iframe>' - - # do search-request def request(query, params): offset = (params['pageno'] - 1) * 20 @@ -66,10 +62,15 @@ def response(resp): url = result['external_urls']['spotify'] content = '{} - {} - {}'.format(result['artists'][0]['name'], result['album']['name'], result['name']) - embedded = embedded_url.format(audioid=result['id']) - # append result - results.append({'url': url, 'title': title, 'embedded': embedded, 'content': content}) + results.append( + { + 'url': url, + 'title': title, + 'data_src': "https://embed.spotify.com/?uri=spotify:track:" + result['id'], + 'content': content, + } + ) # return results return results |