aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-01-24 23:02:20 +0700
committerSergey M․ <dstftw@gmail.com>2017-01-24 23:03:09 +0700
commitaf59bddc4e4a6c260e7966fe75d9d687c3b13b32 (patch)
tree5b3bedd3afffdc4287e6d2396537da2ab81a32e5 /youtube_dl/extractor
parent23b35a634e06d9b92c9650b0d66a3d5d7eb03a54 (diff)
[konserthusetplay] Extract subtitles (#11823)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/konserthusetplay.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/youtube_dl/extractor/konserthusetplay.py b/youtube_dl/extractor/konserthusetplay.py
index 7e6ea9696..3ae2aa317 100644
--- a/youtube_dl/extractor/konserthusetplay.py
+++ b/youtube_dl/extractor/konserthusetplay.py
@@ -2,6 +2,7 @@
from __future__ import unicode_literals
from .common import InfoExtractor
+from ..compat import compat_str
from ..utils import (
determine_ext,
float_or_none,
@@ -104,6 +105,13 @@ class KonserthusetPlayIE(InfoExtractor):
thumbnail = media.get('image')
duration = float_or_none(media.get('duration'), 1000)
+ subtitles = {}
+ captions = source.get('captionsAvailableLanguages')
+ if isinstance(captions, dict):
+ for lang, subtitle_url in captions.items():
+ if lang != 'none' and isinstance(subtitle_url, compat_str):
+ subtitles.setdefault(lang, []).append({'url': subtitle_url})
+
return {
'id': video_id,
'title': title,
@@ -111,4 +119,5 @@ class KonserthusetPlayIE(InfoExtractor):
'thumbnail': thumbnail,
'duration': duration,
'formats': formats,
+ 'subtitles': subtitles,
}