[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
This commit is contained in:
pw3t 2014-01-12 18:31:57 +01:00
parent ad72c16050
commit cf8f444e85
6 changed files with 53 additions and 6 deletions

View file

@ -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