mirror of
https://github.com/searxng/searxng.git
synced 2024-12-23 01:36:29 +00:00
get the not cropped version of the thumbnail when the image height is not too important
This commit is contained in:
parent
040e24f9ad
commit
cef7bbab22
1 changed files with 8 additions and 2 deletions
|
@ -39,6 +39,12 @@ def response(resp):
|
|||
for result in json_results['posts']:
|
||||
result_type = result['type']
|
||||
|
||||
# Get the not cropped version of the thumbnail when the image height is not too important
|
||||
if result['images']['image700']['height'] > 400:
|
||||
thumbnail = result['images']['imageFbThumbnail']['url']
|
||||
else:
|
||||
thumbnail = result['images']['image700']['url']
|
||||
|
||||
if result_type == 'Photo':
|
||||
results.append(
|
||||
{
|
||||
|
@ -48,7 +54,7 @@ def response(resp):
|
|||
'content': result['description'],
|
||||
'publishedDate': datetime.utcfromtimestamp(result['creationTs']),
|
||||
'img_src': result['images']['image700']['url'],
|
||||
'thumbnail_src': result['images']['imageFbThumbnail']['url'],
|
||||
'thumbnail_src': thumbnail,
|
||||
}
|
||||
)
|
||||
elif result_type == 'Animated':
|
||||
|
@ -59,7 +65,7 @@ def response(resp):
|
|||
'title': result['title'],
|
||||
'content': result['description'],
|
||||
'publishedDate': datetime.utcfromtimestamp(result['creationTs']),
|
||||
'thumbnail': result['images']['imageFbThumbnail']['url'],
|
||||
'thumbnail': thumbnail,
|
||||
'iframe_src': result['images'].get('image460sv', {}).get('url'),
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue