[common] Rename to namespace

For consistency with _parse_smil_*
pull/8/head
Yen Chi Hsuan 9 years ago
parent a6c2c24479
commit 16f38a699f

@ -1330,9 +1330,9 @@ class InfoExtractor(object):
}) })
return entries return entries
def _parse_dash_manifest(self, video_id, dash_doc, default_ns='urn:mpeg:DASH:schema:MPD:2011', formats_dict={}, fatal=True): def _parse_dash_manifest(self, video_id, dash_doc, namespace=None, formats_dict={}, fatal=True):
def _add_ns(tag): def _add_ns(path):
return '{%s}%s' % (default_ns, tag) return self._xpath_ns(path, namespace)
formats = [] formats = []
for a in dash_doc.findall('.//' + _add_ns('AdaptationSet')): for a in dash_doc.findall('.//' + _add_ns('AdaptationSet')):

@ -216,7 +216,7 @@ class FacebookIE(InfoExtractor):
if dash_manifest: if dash_manifest:
formats.extend(self._parse_dash_manifest( formats.extend(self._parse_dash_manifest(
video_id, compat_etree_fromstring(compat_urllib_parse_unquote_plus(dash_manifest)), video_id, compat_etree_fromstring(compat_urllib_parse_unquote_plus(dash_manifest)),
default_ns='urn:mpeg:dash:schema:mpd:2011')) namespace='urn:mpeg:dash:schema:mpd:2011'))
if not formats: if not formats:
raise ExtractorError('Cannot find video formats') raise ExtractorError('Cannot find video formats')

@ -1479,7 +1479,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
fatal=dash_mpd_fatal) fatal=dash_mpd_fatal)
for df in self._parse_dash_manifest( for df in self._parse_dash_manifest(
video_id, dash_doc, formats_dict=self._formats, fatal=dash_mpd_fatal): video_id, dash_doc, namespace='urn:mpeg:DASH:schema:MPD:2011', formats_dict=self._formats, fatal=dash_mpd_fatal):
# Do not overwrite DASH format found in some previous DASH manifest # Do not overwrite DASH format found in some previous DASH manifest
if df['format_id'] not in dash_formats: if df['format_id'] not in dash_formats:
dash_formats[df['format_id']] = df dash_formats[df['format_id']] = df

Loading…
Cancel
Save