mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-18 03:17:49 +01:00
[common] Add _extract_dash_manifest_formats
This commit is contained in:
parent
c94678957f
commit
2d2fa82d17
@ -1330,6 +1330,21 @@ class InfoExtractor(object):
|
|||||||
})
|
})
|
||||||
return entries
|
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 _parse_dash_manifest(self, dash_doc, namespace=None, formats_dict={}):
|
||||||
def _add_ns(path):
|
def _add_ns(path):
|
||||||
return self._xpath_ns(path, namespace)
|
return self._xpath_ns(path, namespace)
|
||||||
|
@ -1472,14 +1472,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
return '/signature/%s' % dec_s
|
return '/signature/%s' % dec_s
|
||||||
|
|
||||||
dash_manifest_url = re.sub(r'/s/([a-fA-F0-9\.]+)', decrypt_sig, dash_manifest_url)
|
dash_manifest_url = re.sub(r'/s/([a-fA-F0-9\.]+)', decrypt_sig, dash_manifest_url)
|
||||||
dash_doc = self._download_xml(
|
|
||||||
dash_manifest_url, video_id,
|
|
||||||
note='Downloading DASH manifest',
|
|
||||||
errnote='Could not download DASH manifest',
|
|
||||||
fatal=dash_mpd_fatal)
|
|
||||||
|
|
||||||
for df in self._parse_dash_manifest(
|
for df in self._extract_dash_manifest_formats(
|
||||||
dash_doc, namespace='urn:mpeg:DASH:schema:MPD:2011', formats_dict=self._formats):
|
dash_manifest_url, video_id, fatal=dash_mpd_fatal,
|
||||||
|
namespace='urn:mpeg:DASH:schema:MPD:2011', formats_dict=self._formats):
|
||||||
# Do not overwrite DASH format found in some previous DASH manifest
|
# Do not overwrite DASH format found in some previous DASH manifest
|
||||||
if df['format_id'] not in dash_formats:
|
if df['format_id'] not in dash_formats:
|
||||||
dash_formats[df['format_id']] = df
|
dash_formats[df['format_id']] = df
|
||||||
|
Loading…
Reference in New Issue
Block a user