From 6e3d1b24c197481aba57f88dfd47f2834c286af4 Mon Sep 17 00:00:00 2001 From: Jules-WinnfieldX Date: Thu, 8 Feb 2024 14:01:39 -0700 Subject: [PATCH] move header check --- cyberdrop_dl/__init__.py | 2 +- cyberdrop_dl/managers/client_manager.py | 7 ++++--- pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py index 420245a77..f00a4430a 100644 --- a/cyberdrop_dl/__init__.py +++ b/cyberdrop_dl/__init__.py @@ -1 +1 @@ -__version__ = "5.1.67" \ No newline at end of file +__version__ = "5.1.68" \ No newline at end of file diff --git a/cyberdrop_dl/managers/client_manager.py b/cyberdrop_dl/managers/client_manager.py index 629692c2f..bbe056dd3 100644 --- a/cyberdrop_dl/managers/client_manager.py +++ b/cyberdrop_dl/managers/client_manager.py @@ -76,9 +76,6 @@ async def check_http_status(self, response: ClientResponse, download: bool = Fal headers = response.headers response_url = response.url - if not headers.get('Content-Type'): - raise DownloadFailure(status=CustomHTTPStatus.IM_A_TEAPOT, message="No content-type in response header") - if download: if headers.get('ETag') in ['"eb669b6362e031fa2b0f1215480c4e30"', '"a9e4cee098dc6f1e09ec124299f26b30"']: raise DownloadFailure(status="Bunkr Maintenance", message="Bunkr under maintenance") @@ -96,4 +93,8 @@ async def check_http_status(self, response: ClientResponse, download: bool = Fal response_text = await response.text() if "DDoS-Guard" in response_text: raise DownloadFailure(status="DDOS-Guard", message="DDoS-Guard detected") + + if not headers.get('Content-Type'): + raise DownloadFailure(status=CustomHTTPStatus.IM_A_TEAPOT, message="No content-type in response header") + raise DownloadFailure(status=status, message=f"HTTP status code {status}: {phrase}") diff --git a/pyproject.toml b/pyproject.toml index 605929f1f..87e686175 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cyberdrop-dl" -version = "5.1.67" +version = "5.1.68" description = "Bulk downloader for multiple file hosts" authors = ["Jules Winnfield "] readme = "README.md"