mirror of
https://github.com/searxng/searxng.git
synced 2025-11-07 23:36:52 -05:00
[fix] pinterest: crash when there's no link & show image resolution + uploader name (#5314)
closes #5231
This commit is contained in:
parent
fc7d8b8be2
commit
8baefcc21e
@ -55,15 +55,18 @@ def response(resp):
|
|||||||
if result['type'] == 'story':
|
if result['type'] == 'story':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
main_image = result['images']['orig']
|
||||||
results.append(
|
results.append(
|
||||||
{
|
{
|
||||||
'template': 'images.html',
|
'template': 'images.html',
|
||||||
'url': result['link'] or f"{base_url}/pin/{result['id']}/",
|
'url': result.get('link') or f"{base_url}/pin/{result['id']}/",
|
||||||
'title': result.get('title') or result.get('grid_title'),
|
'title': result.get('title') or result.get('grid_title'),
|
||||||
'content': (result.get('rich_summary') or {}).get('display_description') or "",
|
'content': (result.get('rich_summary') or {}).get('display_description') or "",
|
||||||
'img_src': result['images']['orig']['url'],
|
'img_src': main_image['url'],
|
||||||
'thumbnail_src': result['images']['236x']['url'],
|
'thumbnail_src': result['images']['236x']['url'],
|
||||||
'source': (result.get('rich_summary') or {}).get('site_name'),
|
'source': (result.get('rich_summary') or {}).get('site_name'),
|
||||||
|
'resolution': f"{main_image['width']}x{main_image['height']}",
|
||||||
|
'author': f"{result['pinner'].get('full_name')} ({result['pinner']['username']})",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user