rename _parse_mpd to _parse_mpd_formats and add default value for mpd namespace
authorremitamine <remitamine@gmail.com>
Sat, 6 Feb 2016 13:03:48 +0000 (14:03 +0100)
committerremitamine <remitamine@gmail.com>
Sat, 6 Feb 2016 13:03:48 +0000 (14:03 +0100)
test/test_YoutubeDL.py
youtube_dl/extractor/common.py
youtube_dl/extractor/facebook.py

index 88c63010e9321f26c621bcf879c5cec528c51081..02caf5908233b2971c66dd0db17820a847c3582b 100644 (file)
@@ -249,7 +249,7 @@ class TestFormatSelection(unittest.TestCase):
         def format_info(f_id):
             info = YoutubeIE._formats[f_id].copy()
 
-            # XXX: In real cases InfoExtractor._parse_mpd() fills up 'acodec'
+            # XXX: In real cases InfoExtractor._parse_mpd_formats() fills up 'acodec'
             # and 'vcodec', while in tests such information is incomplete since
             # commit a6c2c24479e5f4827ceb06f64d855329c0a6f593
             # test_YoutubeDL.test_youtube_format_selection is broken without
index 5287fa4f6a40f18c37dae66529d0e9244ff0aab8..271ba37396692ea5242800d06896e5c991ea0de8 100644 (file)
@@ -1343,14 +1343,14 @@ class InfoExtractor(object):
         mpd, urlh = res
         mpd_base_url = re.match(r'https?://.+/', urlh.geturl()).group()
 
-        return self._parse_mpd(
+        return self._parse_mpd_formats(
             compat_etree_fromstring(mpd.encode('utf-8')), mpd_id, mpd_base_url, formats_dict=formats_dict)
 
-    def _parse_mpd(self, mpd_doc, mpd_id=None, mpd_base_url='', formats_dict={}):
+    def _parse_mpd_formats(self, mpd_doc, mpd_id=None, mpd_base_url='', formats_dict={}):
         if mpd_doc.get('type') == 'dynamic':
             return []
 
-        namespace = self._search_regex(r'(?i)^{([^}]+)?}MPD$', mpd_doc.tag, 'namespace')
+        namespace = self._search_regex(r'(?i)^{([^}]+)?}MPD$', mpd_doc.tag, 'namespace', default=None)
 
         def _add_ns(path):
             return self._xpath_ns(path, namespace)
index 9c751178fa79e863e898cfeb892d06e9a1b9f922..ed237f081e2397fe30dc9e4e9c32d590170692de 100644 (file)
@@ -215,7 +215,7 @@ class FacebookIE(InfoExtractor):
                         })
             dash_manifest = f[0].get('dash_manifest')
             if dash_manifest:
-                formats.extend(self._parse_mpd(
+                formats.extend(self._parse_mpd_formats(
                     compat_etree_fromstring(compat_urllib_parse_unquote_plus(dash_manifest))))
         if not formats:
             raise ExtractorError('Cannot find video formats')