mirror of
https://github.com/searxng/searxng.git
synced 2025-09-03 08:48:35 +02:00
[mod] add artwork to mixcloud & soundcloud engines
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
883e9c1ddd
commit
2921d3cd17
2 changed files with 29 additions and 42 deletions
|
@ -81,27 +81,23 @@ def request(query, params):
|
|||
# get response from search-request
|
||||
def response(resp):
|
||||
results = []
|
||||
|
||||
search_res = loads(resp.text)
|
||||
|
||||
# parse results
|
||||
for result in search_res.get('collection', []):
|
||||
|
||||
if result['kind'] in ('track', 'playlist'):
|
||||
title = result['title']
|
||||
content = result['description'] or ''
|
||||
publishedDate = parser.parse(result['last_modified'])
|
||||
uri = quote_plus(result['uri'])
|
||||
res = {
|
||||
'url': result['permalink_url'],
|
||||
'title': result['title'],
|
||||
'content': result['description'] or '',
|
||||
'publishedDate': parser.parse(result['last_modified']),
|
||||
'iframe_src': "https://w.soundcloud.com/player/?url=" + uri,
|
||||
}
|
||||
img_src = result['artwork_url'] or result['user']['avatar_url']
|
||||
if img_src:
|
||||
res['img_src'] = img_src
|
||||
results.append(res)
|
||||
|
||||
# append result
|
||||
results.append(
|
||||
{
|
||||
'url': result['permalink_url'],
|
||||
'title': title,
|
||||
'publishedDate': publishedDate,
|
||||
'iframe_src': "https://w.soundcloud.com/player/?url=" + uri,
|
||||
'content': content,
|
||||
}
|
||||
)
|
||||
|
||||
# return results
|
||||
return results
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue