|  | @@ -11,6 +11,7 @@
 | 
	
		
			
			| 11 | 11 |  from cgi import escape
 | 
	
		
			
			| 12 | 12 |  from urllib import quote_plus
 | 
	
		
			
			| 13 | 13 |  from lxml import html
 | 
	
		
			
			|  | 14 | +from searx.languages import language_codes
 | 
	
		
			
			| 14 | 15 |  
 | 
	
		
			
			| 15 | 16 |  # engine dependent config
 | 
	
		
			
			| 16 | 17 |  categories = ['videos']
 | 
	
	
		
			
			|  | @@ -38,13 +39,22 @@ def response(resp):
 | 
	
		
			
			| 38 | 39 |  
 | 
	
		
			
			| 39 | 40 |      dom = html.fromstring(resp.text)
 | 
	
		
			
			| 40 | 41 |  
 | 
	
		
			
			|  | 42 | +    search_lang = ""
 | 
	
		
			
			|  | 43 | +
 | 
	
		
			
			|  | 44 | +    if resp.search_params['language'] != 'all':
 | 
	
		
			
			|  | 45 | +        search_lang = [lc[1]
 | 
	
		
			
			|  | 46 | +                       for lc in language_codes
 | 
	
		
			
			|  | 47 | +                       if lc[0][:2] == resp.search_params['language']][0]
 | 
	
		
			
			|  | 48 | +
 | 
	
		
			
			| 41 | 49 |      # parse results
 | 
	
		
			
			| 42 | 50 |      for result in dom.xpath(results_xpath):
 | 
	
		
			
			| 43 | 51 |          link = result.xpath(".//a")[0]
 | 
	
		
			
			| 44 | 52 |          href = link.attrib.get('href')
 | 
	
		
			
			| 45 | 53 |  
 | 
	
		
			
			| 46 | 54 |          if language is not "":
 | 
	
		
			
			| 47 |  | -            href = href + language + "/"
 | 
	
		
			
			|  | 55 | +            href = href + language + '/'
 | 
	
		
			
			|  | 56 | +        elif search_lang:
 | 
	
		
			
			|  | 57 | +            href = href + search_lang + '/'
 | 
	
		
			
			| 48 | 58 |  
 | 
	
		
			
			| 49 | 59 |          title = escape(link.xpath(".//text()")[0])
 | 
	
		
			
			| 50 | 60 |  
 |