[extractor] Let _extract_format functions obey --ignore-no-formats

This commit is contained in:
pukkandan 2022-12-15 19:58:57 +05:30
parent 1fc089143c
commit 0b5546c723
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39

View file

@ -1759,6 +1759,9 @@ def _sleep(self, timeout, video_id, msg_template=None):
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={}):
if self.get_param('ignore_no_formats_error'):
fatal = False
res = self._download_xml_handle( 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',
@ -1908,6 +1911,9 @@ def _extract_m3u8_formats_and_subtitles(
errnote=None, fatal=True, live=False, data=None, headers={}, errnote=None, fatal=True, live=False, data=None, headers={},
query={}): query={}):
if self.get_param('ignore_no_formats_error'):
fatal = False
if not m3u8_url: if not m3u8_url:
if errnote is not False: if errnote is not False:
errnote = errnote or 'Failed to obtain m3u8 URL' errnote = errnote or 'Failed to obtain m3u8 URL'
@ -2187,6 +2193,9 @@ def _xpath_ns(path, namespace=None):
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):
if self.get_param('ignore_no_formats_error'):
fatal = False
res = 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 res is False:
assert not fatal assert not fatal
@ -2462,6 +2471,10 @@ def _extract_mpd_formats(self, *args, **kwargs):
def _extract_mpd_formats_and_subtitles( def _extract_mpd_formats_and_subtitles(
self, mpd_url, video_id, mpd_id=None, note=None, errnote=None, self, mpd_url, video_id, mpd_id=None, note=None, errnote=None,
fatal=True, data=None, headers={}, query={}): fatal=True, data=None, headers={}, query={}):
if self.get_param('ignore_no_formats_error'):
fatal = False
res = self._download_xml_handle( res = self._download_xml_handle(
mpd_url, video_id, mpd_url, video_id,
note='Downloading MPD manifest' if note is None else note, note='Downloading MPD manifest' if note is None else note,
@ -2831,6 +2844,9 @@ def _extract_ism_formats(self, *args, **kwargs):
return fmts return fmts
def _extract_ism_formats_and_subtitles(self, ism_url, video_id, ism_id=None, note=None, errnote=None, fatal=True, data=None, headers={}, query={}): def _extract_ism_formats_and_subtitles(self, ism_url, video_id, ism_id=None, note=None, errnote=None, fatal=True, data=None, headers={}, query={}):
if self.get_param('ignore_no_formats_error'):
fatal = False
res = self._download_xml_handle( res = self._download_xml_handle(
ism_url, video_id, ism_url, video_id,
note='Downloading ISM manifest' if note is None else note, note='Downloading ISM manifest' if note is None else note,