Fixed missing segment errors
This commit is contained in:
@@ -91,6 +91,11 @@ def download(
|
||||
|
||||
try:
|
||||
stream = session.get(url, stream=True, **kwargs)
|
||||
if stream.status_code == 404:
|
||||
# Skip missing segments gracefully
|
||||
yield dict(downloaded=f"[yellow]Segment missing (404 skipped)")
|
||||
break
|
||||
|
||||
stream.raise_for_status()
|
||||
|
||||
if not segmented:
|
||||
@@ -139,6 +144,11 @@ def download(
|
||||
DOWNLOAD_SIZES.clear()
|
||||
break
|
||||
except Exception as e:
|
||||
if isinstance(e, requests.HTTPError) and e.response.status_code == 404:
|
||||
# Safe skip, don’t bubble up
|
||||
yield dict(downloaded=f"[yellow]Skipped missing segment: {url}")
|
||||
break
|
||||
|
||||
save_path.unlink(missing_ok=True)
|
||||
if DOWNLOAD_CANCELLED.is_set() or attempts == MAX_ATTEMPTS:
|
||||
raise e
|
||||
|
||||
Reference in New Issue
Block a user