mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2025-01-07 13:47:54 +01:00
Loop all subtitles for Viafree
This commit is contained in:
parent
4569db53ce
commit
3ee59f9423
@ -312,32 +312,19 @@ class TVPlayIE(InfoExtractor):
|
||||
|
||||
# TODO: webvtt in m3u8
|
||||
subtitles = {}
|
||||
sami_path = video.get('sami_path')
|
||||
if sami_path:
|
||||
lang = self._search_regex(
|
||||
r'_([a-z]{2})\.xml', sami_path, 'lang',
|
||||
default=compat_urlparse.urlparse(url).netloc.rsplit('.', 1)[-1])
|
||||
subtitles[lang] = [{
|
||||
'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,
|
||||
}]
|
||||
sub_paths = [
|
||||
video.get('sami_path'),
|
||||
video.get('subtitles_webvtt'),
|
||||
video.get('subtitles_for_hearing_impaired'),
|
||||
]
|
||||
for path in sub_paths:
|
||||
if path:
|
||||
lang = self._search_regex(
|
||||
r'_(.*)(\.)', path, 'lang',
|
||||
default=compat_urlparse.urlparse(url).netloc.rsplit('.', 1)[-1])
|
||||
subtitles[lang] = [{
|
||||
'url': path,
|
||||
}]
|
||||
|
||||
series = video.get('format_title')
|
||||
episode_number = int_or_none(video.get('format_position', {}).get('episode'))
|
||||
|
Loading…
Reference in New Issue
Block a user