mirror of
				https://github.com/searxng/searxng
				synced 2024-01-01 19:24:07 +01:00 
			
		
		
		
	[fix] engine: youtube_api - ignore channels / prevent exceptions
`youtube_api.py` throws an exception if the search results contain a channel, as channels have no videoId. This PR adds a keycheck for parsing the json response.
This commit is contained in:
		
							parent
							
								
									c92846dca8
								
							
						
					
					
						commit
						1746eecf2b
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -56,6 +56,10 @@ def response(resp): | |||
| 
 | ||||
|     # parse results | ||||
|     for result in search_results['items']: | ||||
|         if "videoId" not in result["id"]: | ||||
|             # ignore channels | ||||
|             continue | ||||
| 
 | ||||
|         videoid = result['id']['videoId'] | ||||
| 
 | ||||
|         title = result['snippet']['title'] | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 singletail
						singletail