1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 00:34:31 +01:00

[pbs] restore subtitles

This commit is contained in:
aki 2020-03-22 03:58:48 -07:00
parent 38db9a405a
commit 2dd014693d

View File

@ -14,6 +14,7 @@ from ..utils import (
orderedSet,
strip_jsonp,
strip_or_none,
try_get,
unified_strdate,
url_or_none,
US_RATINGS,
@ -685,6 +686,17 @@ class PBSIE(InfoExtractor):
ttml_caption_suffix, '/%d_Encoded.vtt' % (ttml_caption_id + 2)),
'ext': 'vtt',
}])
else:
captions = try_get(info, lambda x: x['cc'], dict) or {}
if captions:
subtitles['en'] = []
for caption_url in captions.values():
subtitles['en'].extend([{
'ext': re.search(r'\.(\w{3,4})$',
caption_url).group(1),
'url': caption_url
}])
# info['title'] is often incomplete (e.g. 'Full Episode', 'Episode 5', etc)
# Try turning it to 'program - title' naming scheme if possible