|
|
@ -2248,18 +2248,10 @@ class InfoExtractor:
|
|
|
|
if res is False:
|
|
|
|
if res is False:
|
|
|
|
assert not fatal
|
|
|
|
assert not fatal
|
|
|
|
return [], {}
|
|
|
|
return [], {}
|
|
|
|
|
|
|
|
|
|
|
|
smil, urlh = res
|
|
|
|
smil, urlh = res
|
|
|
|
smil_url = urlh.url
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace = self._parse_smil_namespace(smil)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fmts = self._parse_smil_formats(
|
|
|
|
return self._parse_smil_formats_and_subtitles(smil, urlh.url, video_id, f4m_params=f4m_params,
|
|
|
|
smil, smil_url, video_id, namespace=namespace, f4m_params=f4m_params)
|
|
|
|
namespace=self._parse_smil_namespace(smil))
|
|
|
|
subs = self._parse_smil_subtitles(
|
|
|
|
|
|
|
|
smil, namespace=namespace)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return fmts, subs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _extract_smil_formats(self, *args, **kwargs):
|
|
|
|
def _extract_smil_formats(self, *args, **kwargs):
|
|
|
|
fmts, subs = self._extract_smil_formats_and_subtitles(*args, **kwargs)
|
|
|
|
fmts, subs = self._extract_smil_formats_and_subtitles(*args, **kwargs)
|
|
|
@ -2285,9 +2277,8 @@ class InfoExtractor:
|
|
|
|
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._parse_smil_namespace(smil)
|
|
|
|
namespace = self._parse_smil_namespace(smil)
|
|
|
|
|
|
|
|
|
|
|
|
formats = self._parse_smil_formats(
|
|
|
|
formats, subtitles = self._parse_smil_formats_and_subtitles(
|
|
|
|
smil, smil_url, video_id, namespace=namespace, f4m_params=f4m_params)
|
|
|
|
smil, smil_url, video_id, namespace=namespace, f4m_params=f4m_params)
|
|
|
|
subtitles = self._parse_smil_subtitles(smil, namespace=namespace)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
video_id = os.path.splitext(url_basename(smil_url))[0]
|
|
|
|
video_id = os.path.splitext(url_basename(smil_url))[0]
|
|
|
|
title = None
|
|
|
|
title = None
|
|
|
@ -2326,7 +2317,14 @@ class InfoExtractor:
|
|
|
|
return self._search_regex(
|
|
|
|
return self._search_regex(
|
|
|
|
r'(?i)^{([^}]+)?}smil$', smil.tag, 'namespace', default=None)
|
|
|
|
r'(?i)^{([^}]+)?}smil$', smil.tag, 'namespace', default=None)
|
|
|
|
|
|
|
|
|
|
|
|
def _parse_smil_formats(self, smil, smil_url, video_id, namespace=None, f4m_params=None, transform_rtmp_url=None):
|
|
|
|
def _parse_smil_formats(self, *args, **kwargs):
|
|
|
|
|
|
|
|
fmts, subs = self._parse_smil_formats_and_subtitles(*args, **kwargs)
|
|
|
|
|
|
|
|
if subs:
|
|
|
|
|
|
|
|
self._report_ignoring_subs('SMIL')
|
|
|
|
|
|
|
|
return fmts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _parse_smil_formats_and_subtitles(
|
|
|
|
|
|
|
|
self, smil, smil_url, video_id, namespace=None, f4m_params=None, transform_rtmp_url=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)):
|
|
|
|
b = meta.get('base') or meta.get('httpBase')
|
|
|
|
b = meta.get('base') or meta.get('httpBase')
|
|
|
@ -2334,7 +2332,7 @@ class InfoExtractor:
|
|
|
|
base = b
|
|
|
|
base = b
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
formats = []
|
|
|
|
formats, subtitles = [], {}
|
|
|
|
rtmp_count = 0
|
|
|
|
rtmp_count = 0
|
|
|
|
http_count = 0
|
|
|
|
http_count = 0
|
|
|
|
m3u8_count = 0
|
|
|
|
m3u8_count = 0
|
|
|
@ -2382,8 +2380,9 @@ class InfoExtractor:
|
|
|
|
src_url = src_url.strip()
|
|
|
|
src_url = src_url.strip()
|
|
|
|
|
|
|
|
|
|
|
|
if proto == 'm3u8' or src_ext == 'm3u8':
|
|
|
|
if proto == 'm3u8' or src_ext == 'm3u8':
|
|
|
|
m3u8_formats = self._extract_m3u8_formats(
|
|
|
|
m3u8_formats, m3u8_subs = self._extract_m3u8_formats_and_subtitles(
|
|
|
|
src_url, video_id, ext or 'mp4', m3u8_id='hls', fatal=False)
|
|
|
|
src_url, video_id, ext or 'mp4', m3u8_id='hls', fatal=False)
|
|
|
|
|
|
|
|
self._merge_subtitles(m3u8_subs, target=subtitles)
|
|
|
|
if len(m3u8_formats) == 1:
|
|
|
|
if len(m3u8_formats) == 1:
|
|
|
|
m3u8_count += 1
|
|
|
|
m3u8_count += 1
|
|
|
|
m3u8_formats[0].update({
|
|
|
|
m3u8_formats[0].update({
|
|
|
@ -2404,11 +2403,15 @@ class InfoExtractor:
|
|
|
|
f4m_url += urllib.parse.urlencode(f4m_params)
|
|
|
|
f4m_url += urllib.parse.urlencode(f4m_params)
|
|
|
|
formats.extend(self._extract_f4m_formats(f4m_url, video_id, f4m_id='hds', fatal=False))
|
|
|
|
formats.extend(self._extract_f4m_formats(f4m_url, video_id, f4m_id='hds', fatal=False))
|
|
|
|
elif src_ext == 'mpd':
|
|
|
|
elif src_ext == 'mpd':
|
|
|
|
formats.extend(self._extract_mpd_formats(
|
|
|
|
mpd_formats, mpd_subs = self._extract_mpd_formats_and_subtitles(
|
|
|
|
src_url, video_id, mpd_id='dash', fatal=False))
|
|
|
|
src_url, video_id, mpd_id='dash', fatal=False)
|
|
|
|
|
|
|
|
formats.extend(mpd_formats)
|
|
|
|
|
|
|
|
self._merge_subtitles(mpd_subs, target=subtitles)
|
|
|
|
elif re.search(r'\.ism/[Mm]anifest', src_url):
|
|
|
|
elif re.search(r'\.ism/[Mm]anifest', src_url):
|
|
|
|
formats.extend(self._extract_ism_formats(
|
|
|
|
ism_formats, ism_subs = self._extract_ism_formats_and_subtitles(
|
|
|
|
src_url, video_id, ism_id='mss', fatal=False))
|
|
|
|
src_url, video_id, ism_id='mss', fatal=False)
|
|
|
|
|
|
|
|
formats.extend(ism_formats)
|
|
|
|
|
|
|
|
self._merge_subtitles(ism_subs, target=subtitles)
|
|
|
|
elif src_url.startswith('http') and self._is_valid_url(src, video_id):
|
|
|
|
elif src_url.startswith('http') and self._is_valid_url(src, video_id):
|
|
|
|
http_count += 1
|
|
|
|
http_count += 1
|
|
|
|
formats.append({
|
|
|
|
formats.append({
|
|
|
@ -2439,7 +2442,10 @@ class InfoExtractor:
|
|
|
|
'format_note': 'SMIL storyboards',
|
|
|
|
'format_note': 'SMIL storyboards',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
return formats
|
|
|
|
smil_subs = self._parse_smil_subtitles(smil, namespace=namespace)
|
|
|
|
|
|
|
|
self._merge_subtitles(smil_subs, target=subtitles)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return formats, subtitles
|
|
|
|
|
|
|
|
|
|
|
|
def _parse_smil_subtitles(self, smil, namespace=None, subtitles_lang='en'):
|
|
|
|
def _parse_smil_subtitles(self, smil, namespace=None, subtitles_lang='en'):
|
|
|
|
urls = []
|
|
|
|
urls = []
|
|
|
|