mirror of
https://github.com/searxng/searxng.git
synced 2025-12-26 21:50:02 +00:00
[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>
This commit is contained in:
@@ -23,13 +23,7 @@ paging = True
|
||||
# search-url
|
||||
url = 'https://api.deezer.com/'
|
||||
search_url = url + 'search?{query}&index={offset}'
|
||||
|
||||
embedded_url = (
|
||||
'<iframe scrolling="no" frameborder="0" allowTransparency="true" '
|
||||
+ 'data-src="https://www.deezer.com/plugins/player?type=tracks&id={audioid}" '
|
||||
+ 'width="540" height="80"></iframe>'
|
||||
)
|
||||
|
||||
data_src = "https://www.deezer.com/plugins/player?type=tracks&id={audioid}"
|
||||
|
||||
# do search-request
|
||||
def request(query, params):
|
||||
@@ -57,10 +51,10 @@ def response(resp):
|
||||
|
||||
content = '{} - {} - {}'.format(result['artist']['name'], result['album']['title'], result['title'])
|
||||
|
||||
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': data_src.format(audioid=result['id']), 'content': content}
|
||||
)
|
||||
|
||||
# return results
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user