commit
						c43476229b
					
				| @ -40,7 +40,7 @@ else: | |||||||
| with open(settings_path) as settings_yaml: | with open(settings_path) as settings_yaml: | ||||||
|     settings = load(settings_yaml) |     settings = load(settings_yaml) | ||||||
| 
 | 
 | ||||||
| if settings.get('server', {}).get('debug'): | if settings.get('general', {}).get('debug'): | ||||||
|     logging.basicConfig(level=logging.DEBUG) |     logging.basicConfig(level=logging.DEBUG) | ||||||
| else: | else: | ||||||
|     logging.basicConfig(level=logging.WARNING) |     logging.basicConfig(level=logging.WARNING) | ||||||
|  | |||||||
| @ -66,7 +66,15 @@ def response(resp): | |||||||
|         url = link.attrib.get('href') |         url = link.attrib.get('href') | ||||||
| 
 | 
 | ||||||
|         # block google-ad url's |         # block google-ad url's | ||||||
|         if re.match("^http(s|)://www.google.[a-z]+/aclk.*$", url): |         if re.match("^http(s|)://(www\.)?google\.[a-z]+/aclk.*$", url): | ||||||
|  |             continue | ||||||
|  | 
 | ||||||
|  |         # block startpage search url's | ||||||
|  |         if re.match("^http(s|)://(www\.)?startpage\.com/do/search\?.*$", url): | ||||||
|  |             continue | ||||||
|  | 
 | ||||||
|  |         # block ixquick search url's | ||||||
|  |         if re.match("^http(s|)://(www\.)?ixquick\.com/do/search\?.*$", url): | ||||||
|             continue |             continue | ||||||
| 
 | 
 | ||||||
|         title = escape(extract_text(link)) |         title = escape(extract_text(link)) | ||||||
|  | |||||||
| @ -206,6 +206,10 @@ def score_results(results): | |||||||
|         # if there is no duplicate found, append result |         # if there is no duplicate found, append result | ||||||
|         else: |         else: | ||||||
|             res['score'] = score |             res['score'] = score | ||||||
|  |             # if the result has no scheme, use http as default | ||||||
|  |             if res['parsed_url'].scheme == '': | ||||||
|  |                 res['parsed_url'] = res['parsed_url']._replace(scheme="http") | ||||||
|  | 
 | ||||||
|             results.append(res) |             results.append(res) | ||||||
| 
 | 
 | ||||||
|     results = sorted(results, key=itemgetter('score'), reverse=True) |     results = sorted(results, key=itemgetter('score'), reverse=True) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user