summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2025-10-13 07:43:36 +0200
committerGitHub <noreply@github.com>2025-10-13 07:43:36 +0200
commit8baefcc21e289a7ce932d8e7bad4c1fed377c7b3 (patch)
tree268569c4c4358e6e1fcef0ae64b745024e296150 /searx
parentfc7d8b8be221874f8dac0dcedf6ca02a45beca22 (diff)
[fix] pinterest: crash when there's no link & show image resolution + uploader name (#5314)
closes #5231
Diffstat (limited to 'searx')
-rw-r--r--searx/engines/pinterest.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/searx/engines/pinterest.py b/searx/engines/pinterest.py
index 924926677..7937743af 100644
--- a/searx/engines/pinterest.py
+++ b/searx/engines/pinterest.py
@@ -55,15 +55,18 @@ def response(resp):
if result['type'] == 'story':
continue
+ main_image = result['images']['orig']
results.append(
{
'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'),
'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'],
'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']})",
}
)