From 16f38a699f7c6d2820720d704a2373ba28c568b1 Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan Date: Sat, 30 Jan 2016 22:40:13 +0800 Subject: [PATCH] [common] Rename to namespace For consistency with _parse_smil_* --- youtube_dl/extractor/common.py | 6 +++--- youtube_dl/extractor/facebook.py | 2 +- youtube_dl/extractor/youtube.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index f1313ef04..a05efec9e 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -1330,9 +1330,9 @@ class InfoExtractor(object): }) return entries - def _parse_dash_manifest(self, video_id, dash_doc, default_ns='urn:mpeg:DASH:schema:MPD:2011', formats_dict={}, fatal=True): - def _add_ns(tag): - return '{%s}%s' % (default_ns, tag) + def _parse_dash_manifest(self, video_id, dash_doc, namespace=None, formats_dict={}, fatal=True): + def _add_ns(path): + return self._xpath_ns(path, namespace) formats = [] for a in dash_doc.findall('.//' + _add_ns('AdaptationSet')): diff --git a/youtube_dl/extractor/facebook.py b/youtube_dl/extractor/facebook.py index 1f3e270d9..af38eaff1 100644 --- a/youtube_dl/extractor/facebook.py +++ b/youtube_dl/extractor/facebook.py @@ -216,7 +216,7 @@ class FacebookIE(InfoExtractor): if dash_manifest: formats.extend(self._parse_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: raise ExtractorError('Cannot find video formats') diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index f992c3624..8d3fcfa5f 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -1479,7 +1479,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor): fatal=dash_mpd_fatal) 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 if df['format_id'] not in dash_formats: dash_formats[df['format_id']] = df