[fix] unsplash engine - 'searx:result: invalid title:'

- Use result 'alt_description' as title, if not given use
  default title 'unknown'.
- Use result 'description' from unsplash as 'content'

Fix error::

    DEBUG:searx:result: invalid title: {..., 'title': None, 'content': '', 'engine': 'unsplash'}

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-05-25 17:26:58 +02:00
parent a88e3e4fea
commit dc21cb5d4b

View File

@ -62,7 +62,8 @@ def response(resp):
'url': clean_url(result['links']['html']), 'url': clean_url(result['links']['html']),
'thumbnail_src': clean_url(result['urls']['thumb']), 'thumbnail_src': clean_url(result['urls']['thumb']),
'img_src': clean_url(result['urls']['raw']), 'img_src': clean_url(result['urls']['raw']),
'title': result['description'], 'title': result.get('alt_description') or 'unknown',
'content': '' 'content': result.get('description') or ''
}) })
return results return results