mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-01-24 04:10:12 +09:00
Merge 3287b4a114
into c5098961b0
This commit is contained in:
commit
180ce9ecd1
@ -5,10 +5,14 @@ import time
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import compat_HTTPError
|
from ..compat import (
|
||||||
|
compat_HTTPError,
|
||||||
|
compat_str
|
||||||
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
try_get
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -96,6 +100,18 @@ class SonyLIVIE(InfoExtractor):
|
|||||||
episode = metadata.get('episodeTitle')
|
episode = metadata.get('episodeTitle')
|
||||||
if episode and title != episode:
|
if episode and title != episode:
|
||||||
title += ' - ' + episode
|
title += ' - ' + episode
|
||||||
|
subtitles = {}
|
||||||
|
for subtitle in (content.get('subtitle') or []):
|
||||||
|
base_url = try_get(subtitle, lambda x: x['subtitleUrl'], compat_str)
|
||||||
|
if not base_url:
|
||||||
|
continue
|
||||||
|
lang_code = subtitle.get('subtitleLanguageName')
|
||||||
|
if not lang_code:
|
||||||
|
continue
|
||||||
|
subtitles[lang_code] = [{
|
||||||
|
'ext': 'vtt',
|
||||||
|
'url': base_url,
|
||||||
|
}]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
@ -109,4 +125,5 @@ class SonyLIVIE(InfoExtractor):
|
|||||||
'episode': episode,
|
'episode': episode,
|
||||||
'episode_number': int_or_none(metadata.get('episodeNumber')),
|
'episode_number': int_or_none(metadata.get('episodeNumber')),
|
||||||
'release_year': int_or_none(metadata.get('year')),
|
'release_year': int_or_none(metadata.get('year')),
|
||||||
|
'subtitles': subtitles
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user