mirror of
https://github.com/searxng/searxng.git
synced 2025-09-03 16:58:34 +02:00
[mod] simple theme: drop img_src from default results
The use of img_src AND thumbnail in the default results makes no sense (only a thumbnail is needed). In the current state this is rather confusing, because img_src is displayed like a thumbnail (small) and thumbnail is displayed like an image (large). Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
0f2f52f0b5
commit
916739d6b4
37 changed files with 98 additions and 99 deletions
|
@ -365,17 +365,17 @@ def response(resp):
|
|||
logger.debug('ignoring item from the result_xpath list: missing content of title "%s"', title)
|
||||
continue
|
||||
|
||||
img_src = content_nodes[0].xpath('.//img/@src')
|
||||
if img_src:
|
||||
img_src = img_src[0]
|
||||
if img_src.startswith('data:image'):
|
||||
thumbnail = content_nodes[0].xpath('.//img/@src')
|
||||
if thumbnail:
|
||||
thumbnail = thumbnail[0]
|
||||
if thumbnail.startswith('data:image'):
|
||||
img_id = content_nodes[0].xpath('.//img/@id')
|
||||
if img_id:
|
||||
img_src = data_image_map.get(img_id[0])
|
||||
thumbnail = data_image_map.get(img_id[0])
|
||||
else:
|
||||
img_src = None
|
||||
thumbnail = None
|
||||
|
||||
results.append({'url': url, 'title': title, 'content': content, 'img_src': img_src})
|
||||
results.append({'url': url, 'title': title, 'content': content, 'thumbnail': thumbnail})
|
||||
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
logger.error(e, exc_info=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue