on master help sign in
Fix torrent W3C+UX
c59d0c2Cqoicebordel
searx/engines/kickass.py+2−1
@@ -102,6 +102,7 @@ def response(resp):
102 magnetlink = result.xpath(magnet_xpath)[0].attrib['href']
102 magnetlink = result.xpath(magnet_xpath)[0].attrib['href']
103
103
104 torrentfile = result.xpath(torrent_xpath)[0].attrib['href']
104 torrentfile = result.xpath(torrent_xpath)[0].attrib['href']
105+ torrentfileurl = quote(torrentfile, safe="%/:=&?~#+!$,;'@()*")
105
106
106 # append result
107 # append result
107 results.append({'url': href,
108 results.append({'url': href,
@@ -112,7 +113,7 @@ def response(resp):
112 'filesize': filesize,
113 'filesize': filesize,
113 'files': files,
114 'files': files,
114 'magnetlink': magnetlink,
115 'magnetlink': magnetlink,
115− 'torrentfile': torrentfile,
116+ 'torrentfile': torrentfileurl,
116 'template': 'torrent.html'})
117 'template': 'torrent.html'})
117
118
118 # return results sorted by seeder
119 # return results sorted by seeder
searx/templates/oscar/result_templates/torrent.html+7−7
@@ -4,9 +4,11 @@
4
4
5{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
5{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
6<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
7+{% if result.magnetlink %}<small> &bull; <a href="{{ result.magnetlink }}" class="magnetlink">{{ icon('magnet') }} {{ _('magnet link') }}</a></small>{% endif %}
8+{% if result.torrentfile %}<small> &bull; <a href="{{ result.torrentfile }}" class="torrentfile">{{ icon('download-alt') }} {{ _('torrent file') }}</a></small>{% endif %}
7
9
8<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span> &bull; {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
10<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span> &bull; {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
9−{% if result.filesize %}</br>{{ icon('floppy-disk') }} {{ _('Filesize') }}
11+{% if result.filesize %}<br />{{ icon('floppy-disk') }} {{ _('Filesize') }}
10 <span class="badge">
12 <span class="badge">
11 {% if result.filesize < 1024 %}{{ result.filesize }} Byte
13 {% if result.filesize < 1024 %}{{ result.filesize }} Byte
12 {% elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} kb
14 {% elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} kb
@@ -14,13 +16,11 @@
14 {% elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} GB
16 {% elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} GB
15 {% else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} TB{% endif %}
17 {% else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} TB{% endif %}
16 </span>{% endif %}
18 </span>{% endif %}
17−{% if result.files %}</br>{{ icon('file') }} {{ _('Number of Files') }} <span class="badge">{{ result.files }}</span>{% endif %}</p>
19+{% if result.files %}<br />{{ icon('file') }} {{ _('Number of Files') }} <span class="badge">{{ result.files }}</span>{% endif %}
18−<p class="result-content">
20+
19− <a href="{{ result.magnetlink }}" class="magnetlink">{{ icon('magnet') }} {{ _('magnet link') }}</a>
21+{% if result.content %}<br />{{ result.content|safe }}{% endif %}
20− {% if result.torrentfile %}</br><a href="{{ result.torrentfile }}" class="torrentfile">{{ icon('download-alt') }} {{ _('torrent file') }}</a>{% endif %}
21−</p>
22
22
23−{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
23+</p>
24
24
25<div class="clearfix"></div>
25<div class="clearfix"></div>
26
26