Skip to content

Bulk asynchronous downloader for multiple file hosts

Better error reporting than "1"

Jules-WinnfieldXa4fafb394d6a
diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py
index edaa848cc..8410fcbff 100644
--- a/cyberdrop_dl/__init__.py
+++ b/cyberdrop_dl/__init__.py
@@ -1 +1 @@
-__version__ = "5.2.7"
\ No newline at end of file
+__version__ = "5.2.8"
\ No newline at end of file
diff --git a/cyberdrop_dl/downloader/downloader.py b/cyberdrop_dl/downloader/downloader.py
index 5f50a09fe..d46032b1f 100644
--- a/cyberdrop_dl/downloader/downloader.py
+++ b/cyberdrop_dl/downloader/downloader.py
@@ -362,19 +362,9 @@ class Downloader:
await self.manager.progress_manager.download_progress.add_completed()
return
- except (aiohttp.ServerDisconnectedError, asyncio.TimeoutError, aiohttp.ServerTimeoutError) as e:
- if partial_file and partial_file.is_file():
- size = partial_file.stat().st_size
- if partial_file.name in self._current_attempt_filesize and self._current_attempt_filesize[media_item.filename] >= size:
- raise DownloadFailure(status=getattr(e, "status", 1), message="Download timeout reached, retrying")
- self._current_attempt_filesize[media_item.filename] = size
- media_item.current_attempt = 0
- raise DownloadFailure(status=999, message="Download timeout reached, retrying")
-
- raise DownloadFailure(status=getattr(e, "status", 1), message=repr(e))
-
except (aiohttp.ClientPayloadError, aiohttp.ClientOSError, aiohttp.ClientResponseError, ConnectionResetError,
- DownloadFailure, FileNotFoundError, PermissionError) as e:
+ DownloadFailure, FileNotFoundError, PermissionError, aiohttp.ServerDisconnectedError,
+ asyncio.TimeoutError, aiohttp.ServerTimeoutError) as e:
if hasattr(e, "status"):
if ((await is_4xx_client_error(e.status) and e.status != HTTPStatus.TOO_MANY_REQUESTS)
or e.status == HTTPStatus.SERVICE_UNAVAILABLE
@@ -392,7 +382,14 @@ class Downloader:
else:
await log(f"Download Failed: {media_item.url} with status {e.status}", 40)
await self.manager.log_manager.write_download_error_log(media_item.url, f" {e.status}")
-
return
- raise DownloadFailure(status=getattr(e, "status", 1), message=getattr(e, "message", repr(e)))
+ if partial_file and partial_file.is_file():
+ size = partial_file.stat().st_size
+ if partial_file.name in self._current_attempt_filesize and self._current_attempt_filesize[media_item.filename] >= size:
+ raise DownloadFailure(status=getattr(e, "status", type(e).__name__), message="Download failed")
+ self._current_attempt_filesize[media_item.filename] = size
+ media_item.current_attempt = 0
+ raise DownloadFailure(status=999, message="Download timeout reached, retrying")
+
+ raise DownloadFailure(status=getattr(e, "status", type(e).__name__), message=repr(e))
diff --git a/pyproject.toml b/pyproject.toml
index 072641b33..b5d435640 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cyberdrop-dl"
-version = "5.2.7"
+version = "5.2.8"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"