mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-28 02:06:51 +01:00
[extractor/common] Extract namespace parse routine
This commit is contained in:
parent
41c3a5a7be
commit
17712eeb19
@ -999,8 +999,7 @@ class InfoExtractor(object):
|
|||||||
assert not fatal
|
assert not fatal
|
||||||
return []
|
return []
|
||||||
|
|
||||||
namespace = self._search_regex(
|
namespace = self._parse_smil_namespace(smil)
|
||||||
r'{([^}]+)?}smil', smil.tag, 'namespace', default=None)
|
|
||||||
|
|
||||||
return self._parse_smil_formats(
|
return self._parse_smil_formats(
|
||||||
smil, smil_url, video_id, namespace=namespace, f4m_params=f4m_params)
|
smil, smil_url, video_id, namespace=namespace, f4m_params=f4m_params)
|
||||||
@ -1017,8 +1016,7 @@ class InfoExtractor(object):
|
|||||||
'Unable to download SMIL file', fatal=fatal)
|
'Unable to download SMIL file', fatal=fatal)
|
||||||
|
|
||||||
def _parse_smil(self, smil, smil_url, video_id, f4m_params=None):
|
def _parse_smil(self, smil, smil_url, video_id, f4m_params=None):
|
||||||
namespace = self._search_regex(
|
namespace = self._parse_smil_namespace(smil)
|
||||||
r'{([^}]+)?}smil', smil.tag, 'namespace', default=None)
|
|
||||||
|
|
||||||
formats = self._parse_smil_formats(
|
formats = self._parse_smil_formats(
|
||||||
smil, smil_url, video_id, namespace=namespace, f4m_params=f4m_params)
|
smil, smil_url, video_id, namespace=namespace, f4m_params=f4m_params)
|
||||||
@ -1045,6 +1043,10 @@ class InfoExtractor(object):
|
|||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _parse_smil_namespace(self, smil):
|
||||||
|
return self._search_regex(
|
||||||
|
r'(?i)^{([^}]+)?}smil$', smil.tag, 'namespace', default=None)
|
||||||
|
|
||||||
def _parse_smil_formats(self, smil, smil_url, video_id, namespace=None, f4m_params=None):
|
def _parse_smil_formats(self, smil, smil_url, video_id, namespace=None, f4m_params=None):
|
||||||
base = smil_url
|
base = smil_url
|
||||||
for meta in smil.findall(self._xpath_ns('./head/meta', namespace)):
|
for meta in smil.findall(self._xpath_ns('./head/meta', namespace)):
|
||||||
|
Loading…
Reference in New Issue
Block a user