1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2025-01-30 14:49:48 +00:00

PBS video subtitles should now be downloaded.

This commit is contained in:
Raphaël Doré 2018-09-04 14:15:16 -04:00
parent 63529e935c
commit 6b4130962c

View File

@ -666,25 +666,18 @@ class PBSIE(InfoExtractor):
age_limit = US_RATINGS.get(rating_str) age_limit = US_RATINGS.get(rating_str)
subtitles = {} subtitles = {}
closed_captions_url = info.get('closed_captions_url')
if closed_captions_url: closed_captions_urls = info.get('cc')
subtitles['en'] = [{ if closed_captions_urls:
'ext': 'ttml', for (subtitle_format_name, subtitle_url) in closed_captions_urls.items():
'url': closed_captions_url, # There seems to be issues when embedding converted .sami subtitles. Not sure why.
}] if subtitle_format_name == 'Caption-SAMI':
mobj = re.search(r'/(\d+)_Encoded\.dfxp', closed_captions_url) continue
if mobj:
ttml_caption_suffix, ttml_caption_id = mobj.group(0, 1) subtitles.setdefault('en', []).append({
ttml_caption_id = int(ttml_caption_id) 'ext': determine_ext(subtitle_url),
subtitles['en'].extend([{ 'url': subtitle_url,
'url': closed_captions_url.replace( })
ttml_caption_suffix, '/%d_Encoded.srt' % (ttml_caption_id + 1)),
'ext': 'srt',
}, {
'url': closed_captions_url.replace(
ttml_caption_suffix, '/%d_Encoded.vtt' % (ttml_caption_id + 2)),
'ext': 'vtt',
}])
# info['title'] is often incomplete (e.g. 'Full Episode', 'Episode 5', etc) # info['title'] is often incomplete (e.g. 'Full Episode', 'Episode 5', etc)
# Try turning it to 'program - title' naming scheme if possible # Try turning it to 'program - title' naming scheme if possible