mirror of
				https://github.com/searxng/searxng
				synced 2024-01-01 19:24:07 +01:00 
			
		
		
		
	[fix] handle /sorry redirects
This commit is contained in:
		
							parent
							
								
									1435ae7e96
								
							
						
					
					
						commit
						1613c6319e
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -9,6 +9,7 @@ | ||||||
| # @parse       url, title, content, suggestion | # @parse       url, title, content, suggestion | ||||||
| 
 | 
 | ||||||
| import re | import re | ||||||
|  | from flask_babel import gettext | ||||||
| from lxml import html, etree | from lxml import html, etree | ||||||
| from searx.engines.xpath import extract_text, extract_url | from searx.engines.xpath import extract_text, extract_url | ||||||
| from searx import logger | from searx import logger | ||||||
|  | @ -209,6 +210,9 @@ def response(resp): | ||||||
|     if resp_url.netloc == 'sorry.google.com' or resp_url.path == '/sorry/IndexRedirect': |     if resp_url.netloc == 'sorry.google.com' or resp_url.path == '/sorry/IndexRedirect': | ||||||
|         raise RuntimeWarning('sorry.google.com') |         raise RuntimeWarning('sorry.google.com') | ||||||
| 
 | 
 | ||||||
|  |     if resp_url.path.startswith('/sorry'): | ||||||
|  |         raise RuntimeWarning(gettext('CAPTCHA required')) | ||||||
|  | 
 | ||||||
|     # which hostname ? |     # which hostname ? | ||||||
|     google_hostname = resp.search_params.get('google_hostname') |     google_hostname = resp.search_params.get('google_hostname') | ||||||
|     google_url = "https://" + google_hostname |     google_url = "https://" + google_hostname | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Adam Tauber
						Adam Tauber