Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
add _additional_headers to get_size req
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Mar 14, 2024
1 parent bc5d055 commit 5e4f899
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cyberdrop_dl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.2.5"
__version__ = "5.2.6"
3 changes: 2 additions & 1 deletion cyberdrop_dl/clients/download_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion cyberdrop_dl/downloader/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 5e4f899

Please sign in to comment.