diff options
| author | asciimoo <asciimoo@gmail.com> | 2013-10-25 02:14:26 +0200 |
|---|---|---|
| committer | asciimoo <asciimoo@gmail.com> | 2013-10-25 02:14:26 +0200 |
| commit | ea475ee709379b2189eb83a32f76c5b5427a2a60 (patch) | |
| tree | 49991e5da278ffd36aed830446e24bcac4bf401f /searx/webapp.py | |
| parent | d9011f673e170c8a404f9a00c47428765e3fac5c (diff) | |
[enh] url prettify
Diffstat (limited to 'searx/webapp.py')
| -rw-r--r-- | searx/webapp.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 7867d66f6..84835b826 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -79,6 +79,11 @@ def index(): selected_categories.append(ccateg) query = request_data['q'].encode('utf-8') results = search(query, request, selected_categories) + for result in results: + if len(result['url']) > 74: + result['pretty_url'] = result['url'][:35] + '[..]' + result['url'][-35:] + else: + result['pretty_url'] = result['url'] if request_data.get('format') == 'json': return Response(json.dumps({'query': query, 'results': results}), mimetype='application/json') template = render('results.html' |