From 831add33f07339701c0851c8a3591a438ec33033 Mon Sep 17 00:00:00 2001 From: asciimoo Date: Tue, 22 Oct 2013 19:36:30 +0200 Subject: [PATCH] [enh] thumbnails to youtube video results --- searx/engines/youtube.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 += '' % (result['media$group']['media$thumbnail'][0]['url']) + if len(content): + content += '
' + result['content']['$t'] + else: + content = result['content']['$t'] + results.append({'url': url, 'title': title, 'content': content}) return results