mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 18:41:29 +00:00
[extractor/youtube] Retry manifest refresh for live-from-start (#5670)
Avoids ending download early when live stream is temporarily offline. Best used with somewhat large `--retry-sleep extractor:` and `--extractor-retries` Authored by: mzhou
This commit is contained in:
parent
84e0e33a19
commit
253ac4ba6a
|
@ -2650,18 +2650,19 @@ def mpd_feed(format_id, delay):
|
||||||
"""
|
"""
|
||||||
@returns (manifest_url, manifest_stream_number, is_live) or None
|
@returns (manifest_url, manifest_stream_number, is_live) or None
|
||||||
"""
|
"""
|
||||||
|
for retry in self.RetryManager(fatal=False):
|
||||||
with lock:
|
with lock:
|
||||||
refetch_manifest(format_id, delay)
|
refetch_manifest(format_id, delay)
|
||||||
|
|
||||||
f = next((f for f in formats if f['format_id'] == format_id), None)
|
f = next((f for f in formats if f['format_id'] == format_id), None)
|
||||||
if not f:
|
if not f:
|
||||||
if not is_live:
|
if not is_live:
|
||||||
self.to_screen(f'{video_id}: Video is no longer live')
|
retry.error = f'{video_id}: Video is no longer live'
|
||||||
else:
|
else:
|
||||||
self.report_warning(
|
retry.error = f'Cannot find refreshed manifest for format {format_id}{bug_reports_message()}'
|
||||||
f'Cannot find refreshed manifest for format {format_id}{bug_reports_message()}')
|
continue
|
||||||
return None
|
|
||||||
return f['manifest_url'], f['manifest_stream_number'], is_live
|
return f['manifest_url'], f['manifest_stream_number'], is_live
|
||||||
|
return None
|
||||||
|
|
||||||
for f in formats:
|
for f in formats:
|
||||||
f['is_live'] = is_live
|
f['is_live'] = is_live
|
||||||
|
|
Loading…
Reference in a new issue