mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
[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>
This commit is contained in:
parent
66f6495a22
commit
36a6f9c95f
1 changed files with 4 additions and 4 deletions
|
@ -63,8 +63,8 @@ def response(resp):
|
||||||
if not url:
|
if not url:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
img_src = result['item'].get('service_medium')
|
img_list = result.get('image_url')
|
||||||
if not img_src or img_src == 'https://memory.loc.gov/pp/grp.gif':
|
if not img_list:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
title = result['title']
|
title = result['title']
|
||||||
|
@ -88,8 +88,8 @@ def response(resp):
|
||||||
'url': url,
|
'url': url,
|
||||||
'title': title,
|
'title': title,
|
||||||
'content': ' / '.join([i for i in content_items if i]),
|
'content': ' / '.join([i for i in content_items if i]),
|
||||||
'img_src': img_src,
|
'img_src': img_list[-1],
|
||||||
'thumbnail_src': result['item'].get('thumb_gallery'),
|
'thumbnail_src': img_list[0],
|
||||||
'author': author,
|
'author': author,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue