mirror of
				https://github.com/searxng/searxng
				synced 2024-01-01 19:24:07 +01:00 
			
		
		
		
	[pylint] Bing (Images) engine
Fix remarks from pylint and remove obsolete try/except block Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
		
							parent
							
								
									c6922ae7c5
								
							
						
					
					
						commit
						dc4f1f705d
					
				
					 1 changed files with 27 additions and 28 deletions
				
			
		|  | @ -1,11 +1,13 @@ | |||
| # SPDX-License-Identifier: AGPL-3.0-or-later | ||||
| """ | ||||
|  Bing (Images) | ||||
| # lint: pylint | ||||
| """Bing (Images) | ||||
| 
 | ||||
| """ | ||||
| 
 | ||||
| from urllib.parse import urlencode | ||||
| from lxml import html | ||||
| from json import loads | ||||
| from urllib.parse import urlencode | ||||
| 
 | ||||
| from lxml import html | ||||
| 
 | ||||
| from searx.utils import match_language | ||||
| from searx.engines.bing import language_aliases | ||||
|  | @ -77,7 +79,6 @@ def response(resp): | |||
| 
 | ||||
|     # parse results | ||||
|     for result in dom.xpath('//div[@class="imgpt"]'): | ||||
|         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 | ||||
|  | @ -101,7 +102,5 @@ def response(resp): | |||
|                 'img_format': img_format, | ||||
|             } | ||||
|         ) | ||||
|         except: | ||||
|             continue | ||||
| 
 | ||||
|     return results | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Markus Heiser
						Markus Heiser