Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
fix: use acquire instead of context manager
NTFSvolume6f6c693f8b8b
diff --git a/cyberdrop_dl/clients/download_client.py b/cyberdrop_dl/clients/download_client.pyindex 13b396896..ae218154b 100644--- a/cyberdrop_dl/clients/download_client.py+++ b/cyberdrop_dl/clients/download_client.py@@ -196,12 +196,12 @@ class DownloadClient:if not media_item.partial_file.is_file():media_item.partial_file.touch()async with aiofiles.open(media_item.partial_file, mode="ab") as f: # type: ignore- async for chunk, _ in content.iter_chunked(self.client_manager.speed_limiter.chunk_size):+ async for chunk in content.iter_chunked(self.client_manager.speed_limiter.chunk_size):chunk_size = len(chunk)- async with self.client_manager.speed_limiter(chunk_size):- await asyncio.sleep(0)- await f.write(chunk)- update_progress(chunk_size)+ await self.client_manager.speed_limiter.acquire(chunk_size)+ await asyncio.sleep(0)+ await f.write(chunk)+ update_progress(chunk_size)if not content.total_bytes and not media_item.partial_file.stat().st_size:media_item.partial_file.unlink()raise DownloadError(status=HTTPStatus.INTERNAL_SERVER_ERROR, message="File is empty")