summaryrefslogtreecommitdiff
path: root/searx/engines/bing_images.py
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2024-02-20 10:51:58 +0100
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-02-25 16:22:37 +0100
commite76ab1a4b3a99b0ec2ef90c3aadc92ffbf6889b1 (patch)
treebe5443686fbe1ab6a6fa95e55a12a189230ba92e /searx/engines/bing_images.py
parentb683aa63fb3e1689c28bd4b762b4ad962e8e232c (diff)
downloadsearxng-e76ab1a4b3a99b0ec2ef90c3aadc92ffbf6889b1.tar.gz
searxng-e76ab1a4b3a99b0ec2ef90c3aadc92ffbf6889b1.zip
[refactor] images: add resolution, image format and filesize fields
Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/bing_images.py')
-rw-r--r--searx/engines/bing_images.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/searx/engines/bing_images.py b/searx/engines/bing_images.py
index faf0941c8..788c90278 100644
--- a/searx/engines/bing_images.py
+++ b/searx/engines/bing_images.py
@@ -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