aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/common.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-01-30 22:52:23 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2016-01-30 22:52:23 +0800
commit2d2fa82d172a10a49fb5449fa35bc409de778f05 (patch)
tree3626756895331c3ae8ca71505a2ab07d437d873b /youtube_dl/extractor/common.py
parentc94678957fbe4483b2b7c8b3e6824cb7a215d42d (diff)
[common] Add _extract_dash_manifest_formats
Diffstat (limited to 'youtube_dl/extractor/common.py')
-rw-r--r--youtube_dl/extractor/common.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index 5a2b7a721..199a04d1c 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -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)