mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-15 18:34:22 +00:00
[konserthusetplay] Extract subtitles (#11823)
This commit is contained in:
parent
23b35a634e
commit
af59bddc4e
@ -2,6 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_str
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
determine_ext,
|
determine_ext,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
@ -104,6 +105,13 @@ class KonserthusetPlayIE(InfoExtractor):
|
|||||||
thumbnail = media.get('image')
|
thumbnail = media.get('image')
|
||||||
duration = float_or_none(media.get('duration'), 1000)
|
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 {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
@ -111,4 +119,5 @@ class KonserthusetPlayIE(InfoExtractor):
|
|||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
'subtitles': subtitles,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user