forked from zaclys/searxng
		
	Replace every bunch of whitespaces with only one space in HTML text
This commit is contained in:
		
							parent
							
								
									a3d444ab85
								
							
						
					
					
						commit
						52a57ee045
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -119,6 +119,8 @@ class HTMLTextExtractor(HTMLParser):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def html_to_text(html):
 | 
			
		||||
    html = html.replace('\n', ' ')
 | 
			
		||||
    html = ' '.join(html.split())
 | 
			
		||||
    s = HTMLTextExtractor()
 | 
			
		||||
    s.feed(html)
 | 
			
		||||
    return s.get_text()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue