Merge pull request #8348 from remitamine/dfxp2srt-text
[youtube-dl] / youtube_dl / extractor / common.py
index 5a2b7a7219ab2070bd997803478dbbae8a55554f..199a04d1c2b3d7da1b66b65f7f1b16543484e9dd 100644 (file)
@@ -1330,6 +1330,21 @@ class InfoExtractor(object):
             })
         return entries
 
+    def _download_dash_manifest(self, dash_manifest_url, video_id, fatal=True):
+        return self._download_xml(
+            dash_manifest_url, video_id,
+            note='Downloading DASH manifest',
+            errnote='Could not download DASH manifest',
+            fatal=fatal)
+
+    def _extract_dash_manifest_formats(self, dash_manifest_url, video_id, fatal=True, namespace=None, formats_dict={}):
+        dash_doc = self._download_dash_manifest(dash_manifest_url, video_id, fatal)
+        if dash_doc is False:
+            return []
+
+        return self._parse_dash_manifest(
+            dash_doc, namespace=namespace, formats_dict=formats_dict)
+
     def _parse_dash_manifest(self, dash_doc, namespace=None, formats_dict={}):
         def _add_ns(path):
             return self._xpath_ns(path, namespace)