mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-15 08:58:28 +00:00
Repair fragments in info file from --live-from-start. See #13906
This commit is contained in:
parent
38c2bf4026
commit
48ef4303e9
@ -1840,6 +1840,27 @@ def add_default_extra_info(self, ie_result, ie, url):
|
|||||||
'extractor_key': ie.ie_key(),
|
'extractor_key': ie.ie_key(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# Repair fragments in info file from --live-from-start
|
||||||
|
# see https://github.com/yt-dlp/yt-dlp/issues/13906
|
||||||
|
def _repair_ie_fragments(self, ie_result):
|
||||||
|
try:
|
||||||
|
protocol = ie_result.get('protocol')
|
||||||
|
if (protocol is not None
|
||||||
|
and 'http_dash_segments_generator' in protocol.split('+')
|
||||||
|
and ie_result.get('is_live')
|
||||||
|
and bool(self.params.get('live_from_start'))
|
||||||
|
and self.params.get('_load_info_filename') is not None
|
||||||
|
):
|
||||||
|
self.to_screen('Repairing fragments for live-from-start stream from JSON')
|
||||||
|
|
||||||
|
ie = self.get_info_extractor(ie_result.get('extractor_key'))
|
||||||
|
webpage_url = ie_result.get('webpage_url')
|
||||||
|
ie._prepare_live_from_start_formats(
|
||||||
|
ie_result['formats'], ie_result['id'], ie_result.get('release_timestamp'),
|
||||||
|
webpage_url, webpage_url, {}, ie_result.get('live_status') == 'is_live')
|
||||||
|
except Exception as e:
|
||||||
|
self.report_warning(f'Could not repair fragments: {e}')
|
||||||
|
|
||||||
def process_ie_result(self, ie_result, download=True, extra_info=None):
|
def process_ie_result(self, ie_result, download=True, extra_info=None):
|
||||||
"""
|
"""
|
||||||
Take the result of the ie(may be modified) and resolve all unresolved
|
Take the result of the ie(may be modified) and resolve all unresolved
|
||||||
@ -1876,6 +1897,7 @@ def process_ie_result(self, ie_result, download=True, extra_info=None):
|
|||||||
return ie_result
|
return ie_result
|
||||||
|
|
||||||
if result_type == 'video':
|
if result_type == 'video':
|
||||||
|
self._repair_ie_fragments(ie_result)
|
||||||
self.add_extra_info(ie_result, extra_info)
|
self.add_extra_info(ie_result, extra_info)
|
||||||
ie_result = self.process_video_result(ie_result, download=download)
|
ie_result = self.process_video_result(ie_result, download=download)
|
||||||
self._raise_pending_errors(ie_result)
|
self._raise_pending_errors(ie_result)
|
||||||
|
@ -974,6 +974,7 @@ def parse_options(argv=None):
|
|||||||
'_warnings': warnings,
|
'_warnings': warnings,
|
||||||
'_deprecation_warnings': deprecation_warnings,
|
'_deprecation_warnings': deprecation_warnings,
|
||||||
'compat_opts': opts.compat_opts,
|
'compat_opts': opts.compat_opts,
|
||||||
|
'_load_info_filename': opts.load_info_filename,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user