on master help sign in
[fix] skip uncomplete image results - closes #1496
commit6ded6e7a9a011e6a9f379e2088c45bf2e63b2605 authorAdam Tauber <asciimoo@gmail.com> dateMon 31 Aug 2020, 14:00 (6 years ago) parentec5adad
1 file changed+6−7
searx/engines/bing_images.py+6−7
searx/engines/bing_images.py+6−7
@@ -80,14 +80,13 @@ def response(resp):
8080
8181 # parse results
8282 for result in dom.xpath('//div[@class="imgpt"]'):
83−
84− img_format = result.xpath('./div[contains(@class, "img_info")]/span/text()')[0]
85− # Microsoft seems to experiment with this code so don't make the path too specific,
86− # just catch the text section for the first anchor in img_info assuming this to be
87− # the originating site.
88− source = result.xpath('./div[contains(@class, "img_info")]//a/text()')[0]
89−
9083 try:
84+ img_format = result.xpath('./div[contains(@class, "img_info")]/span/text()')[0]
85+ # Microsoft seems to experiment with this code so don't make the path too specific,
86+ # just catch the text section for the first anchor in img_info assuming this to be
87+ # the originating site.
88+ source = result.xpath('./div[contains(@class, "img_info")]//a/text()')[0]
89+
9190 m = loads(result.xpath('./a/@m')[0])
9291
9392 # strip 'Unicode private use area' highlighting, they render to Tux