summaryrefslogtreecommitdiff
path: root/searx/engines/youtube.py
diff options
context:
space:
mode:
authorasciimoo <asciimoo@gmail.com>2013-10-22 19:36:30 +0200
committerasciimoo <asciimoo@gmail.com>2013-10-22 19:36:30 +0200
commit831add33f07339701c0851c8a3591a438ec33033 (patch)
treee9309592b9ee5decea46271c6c33b13c792c9562 /searx/engines/youtube.py
parentea03aaecb4996f270aa9e2ad701a482692ca2d62 (diff)
downloadsearxng-831add33f07339701c0851c8a3591a438ec33033.tar.gz
searxng-831add33f07339701c0851c8a3591a438ec33033.zip
[enh] thumbnails to youtube video results
Diffstat (limited to 'searx/engines/youtube.py')
-rw-r--r--searx/engines/youtube.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/searx/engines/youtube.py b/searx/engines/youtube.py
index a4b523770..bf99642c5 100644
--- a/searx/engines/youtube.py
+++ b/searx/engines/youtube.py
@@ -28,7 +28,14 @@ def response(resp):
if url.endswith('&'):
url = url[:-1]
title = result['title']['$t']
- content = result['content']['$t']
+ content = ''
+ if len(result['media$group']['media$thumbnail']):
+ content += '<img src="%s" />' % (result['media$group']['media$thumbnail'][0]['url'])
+ if len(content):
+ content += '<br />' + result['content']['$t']
+ else:
+ content = result['content']['$t']
+
results.append({'url': url, 'title': title, 'content': content})
return results