diff options
Diffstat (limited to 'searx/webapp.py')
-rw-r--r-- | searx/webapp.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 52ced1363..0d06fbe0c 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -42,6 +42,7 @@ except: from datetime import datetime, timedelta from urllib import urlencode +from urlparse import urlparse from werkzeug.contrib.fixers import ProxyFix from flask import ( Flask, request, render_template, url_for, Response, make_response, @@ -181,6 +182,12 @@ def code_highlighter(codelines, language=None): return html_code +# Extract domain from url +@app.template_filter('extract_domain') +def extract_domain(url): + return urlparse(url)[1] + + def get_base_url(): if settings['server']['base_url']: hostname = settings['server']['base_url'] |