aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/common.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-08-02 01:31:17 +0600
committerSergey M․ <dstftw@gmail.com>2015-08-02 01:31:17 +0600
commit17712eeb1933f53696c1fc53606174e988a96472 (patch)
tree3c0ac9ac5d42310e8a2db377bf1576d5f50b2b4c /youtube_dl/extractor/common.py
parent41c3a5a7beebbf5f60c5edb5093d564f0829c5c1 (diff)
[extractor/common] Extract namespace parse routine
Diffstat (limited to 'youtube_dl/extractor/common.py')
-rw-r--r--youtube_dl/extractor/common.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index c123d9fca..717dcec7b 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -999,8 +999,7 @@ class InfoExtractor(object):
assert not fatal
return []
- namespace = self._search_regex(
- r'{([^}]+)?}smil', smil.tag, 'namespace', default=None)
+ namespace = self._parse_smil_namespace(smil)
return self._parse_smil_formats(
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)
def _parse_smil(self, smil, smil_url, video_id, f4m_params=None):
- namespace = self._search_regex(
- r'{([^}]+)?}smil', smil.tag, 'namespace', default=None)
+ namespace = self._parse_smil_namespace(smil)
formats = self._parse_smil_formats(
smil, smil_url, video_id, namespace=namespace, f4m_params=f4m_params)
@@ -1045,6 +1043,10 @@ class InfoExtractor(object):
'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):
base = smil_url
for meta in smil.findall(self._xpath_ns('./head/meta', namespace)):