mirror of
https://github.com/searxng/searxng.git
synced 2025-08-02 10:02:20 +02:00
[refactor] images: add resolution, image format and filesize fields
Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
b683aa63fb
commit
e76ab1a4b3
15 changed files with 91 additions and 33 deletions
|
@ -92,7 +92,7 @@ def response(resp):
|
|||
|
||||
metadata = json.loads(result.xpath('.//a[@class="iusc"]/@m')[0])
|
||||
title = ' '.join(result.xpath('.//div[@class="infnmpt"]//a/text()')).strip()
|
||||
img_format = ' '.join(result.xpath('.//div[@class="imgpt"]/div/span/text()')).strip()
|
||||
img_format = ' '.join(result.xpath('.//div[@class="imgpt"]/div/span/text()')).strip().split(" · ")
|
||||
source = ' '.join(result.xpath('.//div[@class="imgpt"]//div[@class="lnkw"]//a/text()')).strip()
|
||||
results.append(
|
||||
{
|
||||
|
@ -103,7 +103,8 @@ def response(resp):
|
|||
'content': metadata['desc'],
|
||||
'title': title,
|
||||
'source': source,
|
||||
'img_format': img_format,
|
||||
'resolution': img_format[0],
|
||||
'img_format': img_format[1] if len(img_format) >= 2 else None,
|
||||
}
|
||||
)
|
||||
return results
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue