Browse Source

[enh] highlight piratebay results with light grey border, and indent peers+magnet link

rhapsodhy 11 years ago
parent
commit
b0a4404217
2 changed files with 10 additions and 3 deletions
  1. 3
    3
      searx/engines/piratebay.py
  2. 7
    0
      searx/templates/result_templates/torrent.html

+ 3
- 3
searx/engines/piratebay.py View File

@@ -28,8 +28,8 @@ def response(resp):
28 28
         title = ' '.join(link.xpath('.//text()'))
29 29
         content = escape(' '.join(result.xpath('.//font[@class="detDesc"]//text()')))
30 30
         seed, leech = result.xpath('.//td[@align="right"]/text()')[:2]
31
-        content += '<br />Seed: %s, Leech: %s' % (seed, leech)
32 31
         magnetlink = result.xpath('.//a[@title="Download this torrent using magnet"]')[0]
33
-        content += '<br /><a href="%s">magnet link</a>' % urljoin(url, magnetlink.attrib['href'])
34
-        results.append({'url': href, 'title': title, 'content': content})
32
+        results.append({'url': href, 'title': title, 'content': content,
33
+                        'seed': seed, 'leech': leech, 'magnetlink': magnetlink.attrib['href'],
34
+                        'template': 'torrent.html'})
35 35
     return results

+ 7
- 0
searx/templates/result_templates/torrent.html View File

@@ -0,0 +1,7 @@
1
+<div class="result torrent_result">
2
+    <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
3
+    <p class="content">{% if result.content %}{{ result.content|safe }}<br />{% endif %}</p>
4
+    <p class="stats">Seed: {{ result.seed }}, Leech: {{ result.leech }}</p>
5
+    <p><a href="{{ result.magnetlink }}" class="magnetlink">magnet link</a></p>
6
+    <p class="url">{{ result.pretty_url }}</p>
7
+</div>