on master help sign in
Merge pull request #18 from rsdy/master
6f8daeaAdam Tauber
searx/engines/duckduckgo_definitions.py+4−3
@@ -13,9 +13,10 @@ def response(resp):
13 results = []
13 results = []
14 if 'Definition' in search_res:
14 if 'Definition' in search_res:
15 if search_res.get('AbstractURL'):
15 if search_res.get('AbstractURL'):
16− res = {'title' : search_res.get('Heading', '')
16+ res = {'title' : search_res.get('Heading', '')
17− ,'content' : search_res.get('Definition', '')
17+ ,'content' : search_res.get('Definition', '')
18− ,'url' : search_res.get('AbstractURL', '')
18+ ,'url' : search_res.get('AbstractURL', '')
19+ ,'class' : 'definition_result'
19 }
20 }
20 results.append(res)
21 results.append(res)
21
22
searx/engines/piratebay.py+3−3
@@ -28,8 +28,8 @@ def response(resp):
28 title = ' '.join(link.xpath('.//text()'))
28 title = ' '.join(link.xpath('.//text()'))
29 content = escape(' '.join(result.xpath('.//font[@class="detDesc"]//text()')))
29 content = escape(' '.join(result.xpath('.//font[@class="detDesc"]//text()')))
30 seed, leech = result.xpath('.//td[@align="right"]/text()')[:2]
30 seed, leech = result.xpath('.//td[@align="right"]/text()')[:2]
31− content += '<br />Seed: %s, Leech: %s' % (seed, leech)
32 magnetlink = result.xpath('.//a[@title="Download this torrent using magnet"]')[0]
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 return results
35 return results
searx/static/css/style.css+9−4
@@ -97,6 +97,11 @@ a:visited { color: #7b11be; }
97.image_result p span a { color: #FFFFFF; }
97.image_result p span a { color: #FFFFFF; }
98.image_result p:hover span a { display: block; position: absolute; bottom: 0; right: 0; padding: 4px; background-color: rgba(0, 0, 0, 0.6); font-size: 0.7em; }
98.image_result p:hover span a { display: block; position: absolute; bottom: 0; right: 0; padding: 4px; background-color: rgba(0, 0, 0, 0.6); font-size: 0.7em; }
99
99
100+.torrent_result { border-left: 10px solid lightgray; padding-left: 3px; }
101+.torrent_result p { margin: 3px; font-size: 0.8em; }
102+
103+.definition_result { border-left: 10px solid gray; padding-left: 3px; }
104+
100.percentage { position: relative; width: 300px; }
105.percentage { position: relative; width: 300px; }
101.percentage div { background: #444444; }
106.percentage div { background: #444444; }
102td { padding: 0 4px; }
107td { padding: 0 4px; }
@@ -142,7 +147,7 @@ tr:hover td { background: #DDDDDD; }
142#suggestions form { display: block; }
147#suggestions form { display: block; }
143#suggestions input { padding: 2px 6px; margin: 2px 4px; font-size: 0.8em; display: inline-block; background: #E4E4E4; border-radius: 4px; border: 0; cursor: pointer; }
148#suggestions input { padding: 2px 6px; margin: 2px 4px; font-size: 0.8em; display: inline-block; background: #E4E4E4; border-radius: 4px; border: 0; cursor: pointer; }
144
149
145−#preferences {
150+#preferences {
146 top: 10px;
151 top: 10px;
147 padding: 0;
152 padding: 0;
148 border: 0;
153 border: 0;
@@ -163,7 +168,7 @@ tr:hover td { background: #DDDDDD; }
163}
168}
164
169
165@media screen and (max-width: 60em) {
170@media screen and (max-width: 60em) {
166−
171+
167 #suggestions { position: static; max-width: 50em; margin: 0 0 2px 0; padding: 0; float: none; border: none; width: auto }
172 #suggestions { position: static; max-width: 50em; margin: 0 0 2px 0; padding: 0; float: none; border: none; width: auto }
168 #suggestions span { display: inline; font-size: 0.8em }
173 #suggestions span { display: inline; font-size: 0.8em }
169 #suggestions form { display: inline; }
174 #suggestions form { display: inline; }
@@ -172,13 +177,13 @@ tr:hover td { background: #DDDDDD; }
172}
177}
173
178
174@media screen and (max-width: 680px) {
179@media screen and (max-width: 680px) {
175−
180+
176 #search_wrapper { width: 90%; clear:both; overflow: hidden }
181 #search_wrapper { width: 90%; clear:both; overflow: hidden }
177
182
178 .right { display: none; postion: fixed !important; top: 100px; right: 0px; }
183 .right { display: none; postion: fixed !important; top: 100px; right: 0px; }
179
184
180 #categories { font-size: 80% }
185 #categories { font-size: 80% }
181−
186+
182 #categories .checkbox_container { margin-top: 2px; margin: 0 2px; }
187 #categories .checkbox_container { margin-top: 2px; margin: 0 2px; }
183
188
184 .result { border-top: 1px solid #e8e7e6; margin: 7px 0 6px 0; }
189 .result { border-top: 1px solid #e8e7e6; margin: 7px 0 6px 0; }
searx/templates/result_templates/default.html+1−1
@@ -1,4 +1,4 @@
1−<div class="result">
1+<div class="result {{ result.class }}">
2 <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
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>
3 <p class="content">{% if result.content %}{{ result.content|safe }}<br />{% endif %}</p>
4 <p class="url">{{ result.pretty_url }}</p>
4 <p class="url">{{ result.pretty_url }}</p>
searx/templates/result_templates/torrent.htmlnew file+7
@@ -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>