[extractor] Update manifest_url
s after redirect (#3575)
Authored by: elyse0
This commit is contained in:
parent
b3602f6824
commit
a076c1f97a
1 changed files with 23 additions and 11 deletions
|
@ -1982,17 +1982,19 @@ class InfoExtractor:
|
||||||
def _extract_f4m_formats(self, manifest_url, video_id, preference=None, quality=None, f4m_id=None,
|
def _extract_f4m_formats(self, manifest_url, video_id, preference=None, quality=None, f4m_id=None,
|
||||||
transform_source=lambda s: fix_xml_ampersands(s).strip(),
|
transform_source=lambda s: fix_xml_ampersands(s).strip(),
|
||||||
fatal=True, m3u8_id=None, data=None, headers={}, query={}):
|
fatal=True, m3u8_id=None, data=None, headers={}, query={}):
|
||||||
manifest = self._download_xml(
|
res = self._download_xml_handle(
|
||||||
manifest_url, video_id, 'Downloading f4m manifest',
|
manifest_url, video_id, 'Downloading f4m manifest',
|
||||||
'Unable to download f4m manifest',
|
'Unable to download f4m manifest',
|
||||||
# Some manifests may be malformed, e.g. prosiebensat1 generated manifests
|
# Some manifests may be malformed, e.g. prosiebensat1 generated manifests
|
||||||
# (see https://github.com/ytdl-org/youtube-dl/issues/6215#issuecomment-121704244)
|
# (see https://github.com/ytdl-org/youtube-dl/issues/6215#issuecomment-121704244)
|
||||||
transform_source=transform_source,
|
transform_source=transform_source,
|
||||||
fatal=fatal, data=data, headers=headers, query=query)
|
fatal=fatal, data=data, headers=headers, query=query)
|
||||||
|
if res is False:
|
||||||
if manifest is False:
|
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
manifest, urlh = res
|
||||||
|
manifest_url = urlh.geturl()
|
||||||
|
|
||||||
return self._parse_f4m_formats(
|
return self._parse_f4m_formats(
|
||||||
manifest, manifest_url, video_id, preference=preference, quality=quality, f4m_id=f4m_id,
|
manifest, manifest_url, video_id, preference=preference, quality=quality, f4m_id=f4m_id,
|
||||||
transform_source=transform_source, fatal=fatal, m3u8_id=m3u8_id)
|
transform_source=transform_source, fatal=fatal, m3u8_id=m3u8_id)
|
||||||
|
@ -2400,12 +2402,14 @@ class InfoExtractor:
|
||||||
return '/'.join(out)
|
return '/'.join(out)
|
||||||
|
|
||||||
def _extract_smil_formats_and_subtitles(self, smil_url, video_id, fatal=True, f4m_params=None, transform_source=None):
|
def _extract_smil_formats_and_subtitles(self, smil_url, video_id, fatal=True, f4m_params=None, transform_source=None):
|
||||||
smil = self._download_smil(smil_url, video_id, fatal=fatal, transform_source=transform_source)
|
res = self._download_smil(smil_url, video_id, fatal=fatal, transform_source=transform_source)
|
||||||
|
if res is False:
|
||||||
if smil is False:
|
|
||||||
assert not fatal
|
assert not fatal
|
||||||
return [], {}
|
return [], {}
|
||||||
|
|
||||||
|
smil, urlh = res
|
||||||
|
smil_url = urlh.geturl()
|
||||||
|
|
||||||
namespace = self._parse_smil_namespace(smil)
|
namespace = self._parse_smil_namespace(smil)
|
||||||
|
|
||||||
fmts = self._parse_smil_formats(
|
fmts = self._parse_smil_formats(
|
||||||
|
@ -2422,13 +2426,17 @@ class InfoExtractor:
|
||||||
return fmts
|
return fmts
|
||||||
|
|
||||||
def _extract_smil_info(self, smil_url, video_id, fatal=True, f4m_params=None):
|
def _extract_smil_info(self, smil_url, video_id, fatal=True, f4m_params=None):
|
||||||
smil = self._download_smil(smil_url, video_id, fatal=fatal)
|
res = self._download_smil(smil_url, video_id, fatal=fatal)
|
||||||
if smil is False:
|
if res is False:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
smil, urlh = res
|
||||||
|
smil_url = urlh.geturl()
|
||||||
|
|
||||||
return self._parse_smil(smil, smil_url, video_id, f4m_params=f4m_params)
|
return self._parse_smil(smil, smil_url, video_id, f4m_params=f4m_params)
|
||||||
|
|
||||||
def _download_smil(self, smil_url, video_id, fatal=True, transform_source=None):
|
def _download_smil(self, smil_url, video_id, fatal=True, transform_source=None):
|
||||||
return self._download_xml(
|
return self._download_xml_handle(
|
||||||
smil_url, video_id, 'Downloading SMIL file',
|
smil_url, video_id, 'Downloading SMIL file',
|
||||||
'Unable to download SMIL file', fatal=fatal, transform_source=transform_source)
|
'Unable to download SMIL file', fatal=fatal, transform_source=transform_source)
|
||||||
|
|
||||||
|
@ -2607,11 +2615,15 @@ class InfoExtractor:
|
||||||
return subtitles
|
return subtitles
|
||||||
|
|
||||||
def _extract_xspf_playlist(self, xspf_url, playlist_id, fatal=True):
|
def _extract_xspf_playlist(self, xspf_url, playlist_id, fatal=True):
|
||||||
xspf = self._download_xml(
|
res = self._download_xml_handle(
|
||||||
xspf_url, playlist_id, 'Downloading xpsf playlist',
|
xspf_url, playlist_id, 'Downloading xpsf playlist',
|
||||||
'Unable to download xspf manifest', fatal=fatal)
|
'Unable to download xspf manifest', fatal=fatal)
|
||||||
if xspf is False:
|
if res is False:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
xspf, urlh = res
|
||||||
|
xspf_url = urlh.geturl()
|
||||||
|
|
||||||
return self._parse_xspf(
|
return self._parse_xspf(
|
||||||
xspf, playlist_id, xspf_url=xspf_url,
|
xspf, playlist_id, xspf_url=xspf_url,
|
||||||
xspf_base_url=base_url(xspf_url))
|
xspf_base_url=base_url(xspf_url))
|
||||||
|
|
Loading…
Reference in a new issue