summaryrefslogtreecommitdiff
path: root/searx/engines/bing_images.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2020-08-31 14:00:32 +0200
committerAdam Tauber <asciimoo@gmail.com>2020-08-31 14:07:45 +0200
commit6ded6e7a9a011e6a9f379e2088c45bf2e63b2605 (patch)
treea6616c8e7153b0c991c6540fb9373659ebb37e15 /searx/engines/bing_images.py
parentec5adad851720be245a36018649011e7d0ec8e12 (diff)
downloadsearxng-6ded6e7a9a011e6a9f379e2088c45bf2e63b2605.tar.gz
searxng-6ded6e7a9a011e6a9f379e2088c45bf2e63b2605.zip
[fix] skip uncomplete image results - closes #1496
Diffstat (limited to 'searx/engines/bing_images.py')
-rw-r--r--searx/engines/bing_images.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/searx/engines/bing_images.py b/searx/engines/bing_images.py
index 138ed11c6..93b25008c 100644
--- a/searx/engines/bing_images.py
+++ b/searx/engines/bing_images.py
@@ -80,14 +80,13 @@ def response(resp):
# parse results
for result in dom.xpath('//div[@class="imgpt"]'):
-
- img_format = result.xpath('./div[contains(@class, "img_info")]/span/text()')[0]
- # Microsoft seems to experiment with this code so don't make the path too specific,
- # just catch the text section for the first anchor in img_info assuming this to be
- # the originating site.
- source = result.xpath('./div[contains(@class, "img_info")]//a/text()')[0]
-
try:
+ img_format = result.xpath('./div[contains(@class, "img_info")]/span/text()')[0]
+ # Microsoft seems to experiment with this code so don't make the path too specific,
+ # just catch the text section for the first anchor in img_info assuming this to be
+ # the originating site.
+ source = result.xpath('./div[contains(@class, "img_info")]//a/text()')[0]
+
m = loads(result.xpath('./a/@m')[0])
# strip 'Unicode private use area' highlighting, they render to Tux