summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2024-11-26 09:27:35 +0100
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-11-26 09:36:59 +0100
commit36a6f9c95fe8db95d861aca01c95354545dd5feb (patch)
tree71a35af44952b3ee2112e10586c8e97f589cb3cb
parent66f6495a2253e1c5ec9abae35640ce2a951250e2 (diff)
downloadsearxng-36a6f9c95fe8db95d861aca01c95354545dd5feb.tar.gz
searxng-36a6f9c95fe8db95d861aca01c95354545dd5feb.zip
[fix] engine: Library of Congress - image & thumb links
The properties `item.service_medium` and `item.thumb_gallery` are not given for every result item. It is more reliable to use the first (thumb) and last (image) URL in the list of of URLs in `image_url`. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
-rw-r--r--searx/engines/loc.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/searx/engines/loc.py b/searx/engines/loc.py
index 927800061..919be7d26 100644
--- a/searx/engines/loc.py
+++ b/searx/engines/loc.py
@@ -63,8 +63,8 @@ def response(resp):
if not url:
continue
- img_src = result['item'].get('service_medium')
- if not img_src or img_src == 'https://memory.loc.gov/pp/grp.gif':
+ img_list = result.get('image_url')
+ if not img_list:
continue
title = result['title']
@@ -88,8 +88,8 @@ def response(resp):
'url': url,
'title': title,
'content': ' / '.join([i for i in content_items if i]),
- 'img_src': img_src,
- 'thumbnail_src': result['item'].get('thumb_gallery'),
+ 'img_src': img_list[-1],
+ 'thumbnail_src': img_list[0],
'author': author,
}
)