Skip to content

Bulk asynchronous downloader for multiple file hosts

Fix RE import, add a second bunkr maintenance url.

Jules-WinnfieldXec641ce27d01
diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py
index 6e9a5019f..954af5c8a 100644
--- a/cyberdrop_dl/__init__.py
+++ b/cyberdrop_dl/__init__.py
@@ -1 +1 @@
-__version__ = "4.0.62"
+__version__ = "4.0.63"
diff --git a/cyberdrop_dl/base_functions/config_schema.py b/cyberdrop_dl/base_functions/config_schema.py
index 9f80a1874..7b4280387 100644
--- a/cyberdrop_dl/base_functions/config_schema.py
+++ b/cyberdrop_dl/base_functions/config_schema.py
@@ -103,6 +103,6 @@ ratelimiting_args = ["connection_timeout", "ratelimit", "throttle"]
runtime_args = ["simultaneous_downloads_per_domain", "allow_insecure_connections", "attempts", "disable_attempt_limit",
"include_id", "skip_download_mark_completed", "proxy", "required_free_space", "output_errored_urls",
- "output_unsupported_urls", "block_sub_folders"]
+ "output_unsupported_urls", "block_sub_folders", "remove_bunkr_identifier"]
sorting_args = ["sort_downloads", "sort_directory", "sorted_audio", "sorted_images", "sorted_others", "sorted_videos"]
diff --git a/cyberdrop_dl/client/client.py b/cyberdrop_dl/client/client.py
index 59460b336..8857c9cc3 100644
--- a/cyberdrop_dl/client/client.py
+++ b/cyberdrop_dl/client/client.py
@@ -120,6 +120,8 @@ class DownloadSession:
self.client_session = aiohttp.ClientSession(headers=self.headers, raise_for_status=True, cookie_jar=self.client.cookies, timeout=self.timeouts)
self.throttle_times = {}
+ self.bunkr_maintenance = [URL("https://bnkr.b-cdn.net/maintenance-vid.mp4"), URL("https://bnkr.b-cdn.net/maintenance.mp4")]
+
async def download_file(self, media: MediaItem, file: Path, current_throttle: int, resume_point: int,
proxy: str, headers: dict, file_task: TaskID):
headers['Referer'] = str(media.referer)
@@ -130,7 +132,7 @@ class DownloadSession:
content_type = resp.headers.get('Content-Type')
if not content_type:
raise DownloadFailure(code=418, message="No content-type in response header")
- if resp.url == URL("https://bnkr.b-cdn.net/maintenance.mp4"):
+ if resp.url in self.bunkr_maintenance:
raise DownloadFailure(code=503, message="Bunkr under maintenance")
if 'text' in content_type.lower() or 'html' in content_type.lower():
logger.debug("Server for %s is experiencing issues, you are being ratelimited, or cookies have expired", str(media.url))
@@ -158,7 +160,7 @@ class DownloadSession:
content_type = resp.headers.get('Content-Type')
if not content_type:
raise DownloadFailure(code=418, message="No content-type in response header")
- if resp.url == URL("https://bnkr.b-cdn.net/maintenance.mp4"):
+ if resp.url in self.bunkr_maintenance:
raise DownloadFailure(code=503, message="Bunkr under maintenance")
if 'text' in content_type.lower() or 'html' in content_type.lower():
logger.debug("Server for %s is experiencing issues, you are being ratelimited, or cookies have expired", str(media.url))
diff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.py
index e919cd33e..4ab5c6eb0 100644
--- a/cyberdrop_dl/main.py
+++ b/cyberdrop_dl/main.py
@@ -1,6 +1,7 @@
import argparse
import asyncio
import logging
+import re
from pathlib import Path
import aiofiles