mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
[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:
parent
ad72c16050
commit
cf8f444e85
6 changed files with 53 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue