1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2025-01-07 13:47:54 +01:00

[tvplay] Extract subtitles for Viafree (closes #12685)

This commit is contained in:
David Pedersen 2019-06-17 18:18:53 +02:00
parent 7c24a58bdb
commit 8ae3d21533

View File

@ -310,7 +310,6 @@ class TVPlayIE(InfoExtractor):
self._sort_formats(formats)
# TODO: webvtt in m3u8
subtitles = {}
sami_path = video.get('sami_path')
if sami_path:
@ -321,6 +320,24 @@ class TVPlayIE(InfoExtractor):
'url': sami_path,
}]
subtitles_webvtt = video.get('subtitles_webvtt')
if subtitles_webvtt:
lang = self._search_regex(
r'_([a-z]{2})\.vtt', subtitles_webvtt, 'lang',
default=compat_urlparse.urlparse(url).netloc.rsplit('.', 1)[-1])
subtitles[lang] = [{
'url': subtitles_webvtt,
}]
subtitles_for_hearing_impaired = video.get('subtitles_for_hearing_impaired')
if subtitles_for_hearing_impaired:
lang = self._search_regex(
r'_([a-z]{2})_', subtitles_for_hearing_impaired, 'lang',
default=compat_urlparse.urlparse(url).netloc.rsplit('.', 1)[-1])
subtitles[lang + '_sdh'] = [{
'url': subtitles_for_hearing_impaired,
}]
series = video.get('format_title')
episode_number = int_or_none(video.get('format_position', {}).get('episode'))
season = video.get('_embedded', {}).get('season', {}).get('title')