[youtube] Skip WebVTT in DASH manifest (#5297)

This commit is contained in:
Yen Chi Hsuan 2015-04-08 03:45:02 +08:00
parent a35099bd33
commit de5c545648
1 changed files with 35 additions and 27 deletions

View File

@ -788,10 +788,16 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
errnote='Could not download DASH manifest') errnote='Could not download DASH manifest')
formats = [] formats = []
for r in dash_doc.findall('.//{urn:mpeg:DASH:schema:MPD:2011}Representation'): for a in dash_doc.findall('.//{urn:mpeg:DASH:schema:MPD:2011}AdaptationSet'):
mime_type = a.attrib.get('mimeType')
for r in a.findall('{urn:mpeg:DASH:schema:MPD:2011}Representation'):
url_el = r.find('{urn:mpeg:DASH:schema:MPD:2011}BaseURL') url_el = r.find('{urn:mpeg:DASH:schema:MPD:2011}BaseURL')
if url_el is None: if url_el is None:
continue continue
if mime_type == 'text/vtt':
# TODO implement WebVTT downloading
pass
elif mime_type.startswith('audio/') or mime_type.startswith('video/'):
format_id = r.attrib['id'] format_id = r.attrib['id']
video_url = url_el.text video_url = url_el.text
filesize = int_or_none(url_el.attrib.get('{http://youtube.com/yt/2012/10/10}contentLength')) filesize = int_or_none(url_el.attrib.get('{http://youtube.com/yt/2012/10/10}contentLength'))
@ -815,6 +821,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
formats.append(full_info) formats.append(full_info)
else: else:
existing_format.update(f) existing_format.update(f)
else:
self.report_warning('Unknown MIME type %s in DASH manifest' % mime_type)
return formats return formats
def _real_extract(self, url): def _real_extract(self, url):