diff options
| author | Adam Tauber <asciimoo@gmail.com> | 2014-03-18 18:20:10 +0100 |
|---|---|---|
| committer | Adam Tauber <asciimoo@gmail.com> | 2014-03-18 18:20:10 +0100 |
| commit | 018a14431bd3612db4e8840ce24f3e60026ece0f (patch) | |
| tree | 18c7f0ed489c0c0f206ac1f0a191b1ce0ab045b2 /searx/engines/youtube.py | |
| parent | faed14b2c691746ba6cf98d164a5e6b1ca3ee4c9 (diff) | |
| parent | 993271bed30e24c7ae1e0f63b64e030829206f27 (diff) | |
Merge pull request #57 from pointhi/results
improving publishDate extraction and output of it
Diffstat (limited to 'searx/engines/youtube.py')
| -rw-r--r-- | searx/engines/youtube.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/searx/engines/youtube.py b/searx/engines/youtube.py index 5b04f3513..f6b08b330 100644 --- a/searx/engines/youtube.py +++ b/searx/engines/youtube.py @@ -1,5 +1,7 @@ from json import loads from urllib import urlencode +from dateutil import parser +from datetime import datetime categories = ['videos'] @@ -35,6 +37,10 @@ def response(resp): content = '' thumbnail = '' +#"2013-12-31T15:22:51.000Z" + pubdate = result['published']['$t'] + publishedDate = parser.parse(pubdate) + if result['media$group']['media$thumbnail']: thumbnail = result['media$group']['media$thumbnail'][0]['url'] content += '<a href="{0}" title="{0}" ><img src="{1}" /></a>'.format(url, thumbnail) # noqa @@ -48,6 +54,7 @@ def response(resp): 'title': title, 'content': content, 'template': 'videos.html', + 'publishedDate': publishedDate, 'thumbnail': thumbnail}) return results |