aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-07-23 13:39:19 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-07-23 13:39:19 +0800
commit41597d9bed9eaa5e55d5bb572f2ec3f5a312d392 (patch)
treee9a57dfb34d39052b9f85d64252fc96b1c55d0ae /youtube_dl
parentb37317d8b0391651b396fc2dc4e35b59e52fddf3 (diff)
[viki] Fix description extraction (closes #6339)
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/viki.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/youtube_dl/extractor/viki.py b/youtube_dl/extractor/viki.py
index 3a7e9a0f2..e987badbd 100644
--- a/youtube_dl/extractor/viki.py
+++ b/youtube_dl/extractor/viki.py
@@ -173,6 +173,19 @@ class VikiIE(VikiBaseIE):
}, {
'url': 'http://www.viki.com/player/44699v',
'only_matching': True,
+ }, {
+ # non-English description
+ 'url': 'http://www.viki.com/videos/158036v-love-in-magic',
+ 'md5': '1713ae35df5a521b31f6dc40730e7c9c',
+ 'info_dict': {
+ 'id': '158036v',
+ 'ext': 'mp4',
+ 'uploader': 'I Planet Entertainment',
+ 'upload_date': '20111122',
+ 'timestamp': 1321985454,
+ 'description': 'md5:44b1e46619df3a072294645c770cef36',
+ 'title': 'Love In Magic',
+ },
}]
def _real_extract(self, url):
@@ -192,8 +205,12 @@ class VikiIE(VikiBaseIE):
container_title = container_titles.get('en') or container_titles[container_titles.keys()[0]]
title = '%s - %s' % (container_title, title)
- descriptions = video.get('descriptions')
- description = descriptions.get('en') or descriptions[titles.keys()[0]] if descriptions else None
+ descriptions = video.get('descriptions', {})
+ description = descriptions.get('en')
+ if description is None:
+ filtered_descriptions = list(filter(None, [descriptions.get(k) for k in titles.keys()]))
+ if filtered_descriptions:
+ description = filtered_descriptions[0]
duration = int_or_none(video.get('duration'))
timestamp = parse_iso8601(video.get('created_at'))