From b0a440421772c334b090f89187b747a350d31e5a Mon Sep 17 00:00:00 2001 From: rhapsodhy Date: Sat, 11 Jan 2014 03:33:41 +0000 Subject: [PATCH] [enh] highlight piratebay results with light grey border, and indent peers+magnet link --- searx/engines/piratebay.py | 6 +++--- searx/templates/result_templates/torrent.html | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 searx/templates/result_templates/torrent.html diff --git a/searx/engines/piratebay.py b/searx/engines/piratebay.py index 95ab884d5..11538dd6b 100644 --- a/searx/engines/piratebay.py +++ b/searx/engines/piratebay.py @@ -28,8 +28,8 @@ def response(resp): title = ' '.join(link.xpath('.//text()')) content = escape(' '.join(result.xpath('.//font[@class="detDesc"]//text()'))) seed, leech = result.xpath('.//td[@align="right"]/text()')[:2] - content += '
Seed: %s, Leech: %s' % (seed, leech) magnetlink = result.xpath('.//a[@title="Download this torrent using magnet"]')[0] - content += '
magnet link' % urljoin(url, magnetlink.attrib['href']) - results.append({'url': href, 'title': title, 'content': content}) + results.append({'url': href, 'title': title, 'content': content, + 'seed': seed, 'leech': leech, 'magnetlink': magnetlink.attrib['href'], + 'template': 'torrent.html'}) return results diff --git a/searx/templates/result_templates/torrent.html b/searx/templates/result_templates/torrent.html new file mode 100644 index 000000000..4b7cfbf2a --- /dev/null +++ b/searx/templates/result_templates/torrent.html @@ -0,0 +1,7 @@ +
+

{{ result.title|safe }}

+

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

+

Seed: {{ result.seed }}, Leech: {{ result.leech }}

+

magnet link

+

{{ result.pretty_url }}

+