[common] Rename to namespace
authorYen Chi Hsuan <yan12125@gmail.com>
Sat, 30 Jan 2016 14:40:13 +0000 (22:40 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Sat, 30 Jan 2016 14:40:56 +0000 (22:40 +0800)
For consistency with _parse_smil_*

youtube_dl/extractor/common.py
youtube_dl/extractor/facebook.py
youtube_dl/extractor/youtube.py

index f1313ef04fe926d912322081fba1a08f2bea7141..a05efec9ef87e8eb4fe3c8c09bc39cd90ef232bf 100644 (file)
@@ -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')):
index 1f3e270d9f63ec8cbeff63a2c8be370d06240f0a..af38eaff1eda5fd2798789415614971e7c501bb2 100644 (file)
@@ -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')
 
index f992c3624c0b45b4b9da54b5e69d81c5cf91605e..8d3fcfa5f7ebace20248ee85c9d9dfb74ce910c4 100644 (file)
@@ -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