Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
fix: handle undefined HTTP errors
NTFSvolume0bac6e4fb9ca
diff --git a/cyberdrop_dl/clients/errors.py b/cyberdrop_dl/clients/errors.pyindex f86f8f79d..5a55a477b 100644--- a/cyberdrop_dl/clients/errors.py+++ b/cyberdrop_dl/clients/errors.py@@ -15,7 +15,7 @@ class CDLBaseException(Exception):self.ui_message = ui_messageself.message = message if message else ui_messageself.origin = origin- if not isinstance(origin, (URL, Path)):+ if origin and not isinstance(origin, (URL, Path)):self.origin = origin.parents[0] if origin.parents else Nonesuper().__init__(self.message)if status:@@ -52,13 +52,19 @@ class DDOSGuardFailure(CDLBaseException):class DownloadFailure(CDLBaseException):def __init__(self, status: int, message: Optional[str] = "Download Failure" , origin: Optional[ScrapeItem | URL] = None):"""This error will be thrown when a request fails"""- ui_message = f"{status} {HTTPStatus(status).phrase}" if isinstance (status, int) else status+ try:+ ui_message = f"{status} {HTTPStatus(status).phrase}" if isinstance (status, int) else status+ except ValueError:+ ui_message = statussuper().__init__(ui_message, message = message, status = status, origin=origin)class ScrapeFailure(CDLBaseException):def __init__(self, status: int, message: Optional[str] = "Scrape Failure" , origin: Optional[ScrapeItem | URL] = None):"""This error will be thrown when a scrape fails"""- ui_message = f"{status} {HTTPStatus(status).phrase}" if isinstance (status, int) else status+ try:+ ui_message = f"{status} {HTTPStatus(status).phrase}" if isinstance (status, int) else status+ except ValueError:+ ui_message = statussuper().__init__(ui_message, message = message, status = status, origin=origin)class FailedLoginFailure(CDLBaseException):diff --git a/cyberdrop_dl/ui/progress/statistic_progress.py b/cyberdrop_dl/ui/progress/statistic_progress.pyindex cc07e35e3..66a4bf3a7 100644--- a/cyberdrop_dl/ui/progress/statistic_progress.py+++ b/cyberdrop_dl/ui/progress/statistic_progress.py@@ -73,7 +73,10 @@ class DownloadStatsProgress:"""Adds a failed file to the progress bar"""self.failed_files += 1if isinstance(failure_type, int):- failure_type = f"{failure_type} {HTTPStatus(failure_type).phrase}"+ try:+ failure_type = f"{failure_type} {HTTPStatus(failure_type).phrase}"+ except ValueError:+ failure_type = f"{failure_type} HTTP Error"if failure_type in self.failure_types:self.progress.advance(self.failure_types[failure_type], 1)