1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-12-23 16:36:48 +00:00

[cspan] Extract subtitles

This commit is contained in:
Yen Chi Hsuan 2015-04-24 23:46:51 +08:00
parent 529d26c3e1
commit 672f1bd849

View File

@ -8,6 +8,7 @@ from ..utils import (
unescapeHTML, unescapeHTML,
find_xpath_attr, find_xpath_attr,
smuggle_url, smuggle_url,
determine_ext,
) )
from .senateisvp import SenateISVPIE from .senateisvp import SenateISVPIE
@ -87,6 +88,10 @@ class CSpanIE(InfoExtractor):
return self.url_result(surl, 'SenateISVP', video_id, title) return self.url_result(surl, 'SenateISVP', video_id, title)
files = data['video']['files'] files = data['video']['files']
try:
capfile = data['video']['capfile']['#text']
except KeyError:
capfile = None
entries = [{ entries = [{
'id': '%s_%d' % (video_id, partnum + 1), 'id': '%s_%d' % (video_id, partnum + 1),
@ -97,6 +102,12 @@ class CSpanIE(InfoExtractor):
'description': description, 'description': description,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'duration': int_or_none(f.get('length', {}).get('#text')), 'duration': int_or_none(f.get('length', {}).get('#text')),
'subtitles': {
'en': [{
'url': capfile,
'ext': determine_ext(capfile, 'dfxp')
}],
} if capfile else None,
} for partnum, f in enumerate(files)] } for partnum, f in enumerate(files)]
if len(entries) == 1: if len(entries) == 1: