From 5e4f89972ac0768335b88fb417f36b4298b6a574 Mon Sep 17 00:00:00 2001 From: Jules-WinnfieldX Date: Wed, 13 Mar 2024 21:54:33 -0600 Subject: [PATCH] add _additional_headers to get_size req --- cyberdrop_dl/__init__.py | 2 +- cyberdrop_dl/clients/download_client.py | 3 ++- cyberdrop_dl/downloader/downloader.py | 2 +- pyproject.toml | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py index e654d1af1..f01f6b73b 100644 --- a/cyberdrop_dl/__init__.py +++ b/cyberdrop_dl/__init__.py @@ -1 +1 @@ -__version__ = "5.2.5" \ No newline at end of file +__version__ = "5.2.6" \ No newline at end of file diff --git a/cyberdrop_dl/clients/download_client.py b/cyberdrop_dl/clients/download_client.py index 5e8d376cb..f3051d7a0 100644 --- a/cyberdrop_dl/clients/download_client.py +++ b/cyberdrop_dl/clients/download_client.py @@ -73,10 +73,11 @@ async def on_request_end(session, trace_config_ctx, params): self.trace_configs.append(trace_config) @limiter - async def get_filesize(self, media_item: MediaItem, client_session: ClientSession) -> int: + async def get_filesize(self, media_item: MediaItem, headers_inc: Dict, client_session: ClientSession) -> int: """Returns the file size of the media item""" headers = copy.deepcopy(self._headers) headers['Referer'] = str(media_item.referer) + headers.update(headers_inc) async with client_session.get(media_item.url, headers=headers, ssl=self.client_manager.ssl_context, proxy=self.client_manager.proxy) as resp: diff --git a/cyberdrop_dl/downloader/downloader.py b/cyberdrop_dl/downloader/downloader.py index e2833c846..5f50a09fe 100644 --- a/cyberdrop_dl/downloader/downloader.py +++ b/cyberdrop_dl/downloader/downloader.py @@ -231,7 +231,7 @@ async def get_final_file_info(self, complete_file: Path, partial_file: Path, skip = False while True: if not expected_size: - media_item.filesize = await self.client.get_filesize(media_item) + media_item.filesize = await self.client.get_filesize(media_item, self._additional_headers) file_size_check = await self.check_filesize_limits(media_item) if not file_size_check: proceed = False diff --git a/pyproject.toml b/pyproject.toml index 9efd0bcd9..1bc204024 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cyberdrop-dl" -version = "5.2.5" +version = "5.2.6" description = "Bulk downloader for multiple file hosts" authors = ["Jules Winnfield "] readme = "README.md"