forked from Icycoide/searxng
[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:
parent
b9a2e8b387
commit
98cab4cf75
10 changed files with 62 additions and 53 deletions
|
@ -24,12 +24,7 @@ paging = True
|
|||
# search-url
|
||||
url = 'https://api.mixcloud.com/'
|
||||
search_url = url + 'search/?{query}&type=cloudcast&limit=10&offset={offset}'
|
||||
|
||||
embedded_url = (
|
||||
'<iframe scrolling="no" frameborder="0" allowTransparency="true" '
|
||||
+ 'data-src="https://www.mixcloud.com/widget/iframe/?feed={url}" width="300" height="300"></iframe>'
|
||||
)
|
||||
|
||||
data_src = "https://www.mixcloud.com/widget/iframe/?feed={url}"
|
||||
|
||||
# do search-request
|
||||
def request(query, params):
|
||||
|
@ -51,12 +46,17 @@ def response(resp):
|
|||
title = result['name']
|
||||
url = result['url']
|
||||
content = result['user']['name']
|
||||
embedded = embedded_url.format(url=url)
|
||||
publishedDate = parser.parse(result['created_time'])
|
||||
|
||||
# append result
|
||||
results.append(
|
||||
{'url': url, 'title': title, 'embedded': embedded, 'publishedDate': publishedDate, 'content': content}
|
||||
{
|
||||
'url': url,
|
||||
'title': title,
|
||||
'data_src': data_src.format(url=url),
|
||||
'publishedDate': publishedDate,
|
||||
'content': content,
|
||||
}
|
||||
)
|
||||
|
||||
# return results
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue