diff --git a/searx/engines/kickass.py b/searx/engines/kickass.py index a4d270673..ac349283d 100644 --- a/searx/engines/kickass.py +++ b/searx/engines/kickass.py @@ -102,6 +102,7 @@ def response(resp): magnetlink = result.xpath(magnet_xpath)[0].attrib['href'] torrentfile = result.xpath(torrent_xpath)[0].attrib['href'] + torrentfileurl = quote(torrentfile, safe="%/:=&?~#+!$,;'@()*") # append result results.append({'url': href, @@ -112,7 +113,7 @@ def response(resp): 'filesize': filesize, 'files': files, 'magnetlink': magnetlink, - 'torrentfile': torrentfile, + 'torrentfile': torrentfileurl, 'template': 'torrent.html'}) # return results sorted by seeder diff --git a/searx/templates/oscar/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html index 9258a0cb7..1893282b3 100644 --- a/searx/templates/oscar/result_templates/torrent.html +++ b/searx/templates/oscar/result_templates/torrent.html @@ -4,9 +4,11 @@ {% if result.publishedDate %}{% endif %} {{ icon('link') }} {{ _('cached') }} +{% if result.magnetlink %}{{ icon('magnet') }} {{ _('magnet link') }}{% endif %} +{% if result.torrentfile %}{{ icon('download-alt') }} {{ _('torrent file') }}{% endif %}

{{ icon('transfer') }} {{ _('Seeder') }} {{ result.seed }} • {{ _('Leecher') }} {{ result.leech }} -{% if result.filesize %}
{{ icon('floppy-disk') }} {{ _('Filesize') }} +{% if result.filesize %}
{{ icon('floppy-disk') }} {{ _('Filesize') }} {% if result.filesize < 1024 %}{{ result.filesize }} Byte {% elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} kb @@ -14,13 +16,11 @@ {% elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} GB {% else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} TB{% endif %} {% endif %} -{% if result.files %}
{{ icon('file') }} {{ _('Number of Files') }} {{ result.files }}{% endif %}

-

- {{ icon('magnet') }} {{ _('magnet link') }} - {% if result.torrentfile %}
{{ icon('download-alt') }} {{ _('torrent file') }}{% endif %} -

+{% if result.files %}
{{ icon('file') }} {{ _('Number of Files') }} {{ result.files }}{% endif %} -{% if result.content %}

{{ result.content|safe }}

{% endif %} +{% if result.content %}
{{ result.content|safe }}{% endif %} + +