summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorpw3t <romain@berthor.fr>2014-01-12 18:31:57 +0100
committerpw3t <romain@berthor.fr>2014-01-16 22:03:43 +0100
commitcf8f444e8597bf527ef4bfc691b6d45d5704f77f (patch)
tree6ae1cff9ae2e888251df151f97d882a1fe9008a9 /searx/engines
parentad72c16050932ac5c71e27e4199582b5de38b561 (diff)
[ehn] Add a 'featured result feature'm putting on top of the reasults ddg definitions and wikipedia (ugly html / css)
[ehn] Add a templates for videos, so the thumbnails all have the same side
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/vimeo.py10
-rw-r--r--searx/engines/youtube.py11
2 files changed, 16 insertions, 5 deletions
diff --git a/searx/engines/vimeo.py b/searx/engines/vimeo.py
index 52c89ffdd..35bc3d50a 100644
--- a/searx/engines/vimeo.py
+++ b/searx/engines/vimeo.py
@@ -35,7 +35,11 @@ def response(resp):
for result in dom.xpath(results_xpath):
url = base_url + result.xpath(url_xpath)[0]
title = p.unescape(extract_text(result.xpath(title_xpath)))
- content = '<a href="{0}"> <img src="{2}"/> </a>'.format(url, title, extract_text(result.xpath(content_xpath)[0]))
- results.append({'url': url, 'title': title, 'content': content})
-
+ thumbnail = extract_text(result.xpath(content_xpath)[0])
+ content = '<a href="{0}"> <img src="{2}"/> </a>'.format(url, title, thumbnail)
+ results.append({'url': url
+ , 'title': title
+ , 'content': content
+ , 'template':'videos.html'
+ , 'thumbnail': thumbnail})
return results
diff --git a/searx/engines/youtube.py b/searx/engines/youtube.py
index 1331f480e..cefdb6536 100644
--- a/searx/engines/youtube.py
+++ b/searx/engines/youtube.py
@@ -26,14 +26,21 @@ def response(resp):
url = url[:-1]
title = result['title']['$t']
content = ''
+
+ thumbnail = ''
if len(result['media$group']['media$thumbnail']):
- content += '<a href="{0}" title="{0}" ><img src="{1}" /></a>'.format(url, result['media$group']['media$thumbnail'][0]['url'])
+ thumbnail = result['media$group']['media$thumbnail'][0]['url']
+ content += '<a href="{0}" title="{0}" ><img src="{1}" /></a>'.format(url, thumbnail)
if len(content):
content += '<br />' + result['content']['$t']
else:
content = result['content']['$t']
- results.append({'url': url, 'title': title, 'content': content})
+ results.append({'url': url
+ , 'title': title
+ , 'content': content
+ , 'template':'videos.html'
+ , 'thumbnail':thumbnail})
return results