Skip to content

Bulk asynchronous downloader for multiple file hosts

fix: handle_direct_links for bunkr cdn urls (#662)

datawhores3fcea4b9dc8a
diff --git a/cyberdrop_dl/scraper/__init__.py b/cyberdrop_dl/scraper/__init__.py
index e4e3f65e6..88792f2e9 100644
--- a/cyberdrop_dl/scraper/__init__.py
+++ b/cyberdrop_dl/scraper/__init__.py
@@ -73,8 +73,6 @@ DISABLED_CRAWLERS = {SimpCityCrawler}
DEBUG_CRAWLERS = {BunkrAlbumsIOCrawler}
CRAWLERS = ALL_CRAWLERS - DISABLED_CRAWLERS - DEBUG_CRAWLERS
-constants.RUNNING_PRERELEASE = next((tag for tag in constants.PRERELEASE_TAGS if tag in current_version), False)
-
if env.RUNNING_IN_IDE:
CRAWLERS.update(DEBUG_CRAWLERS)
diff --git a/cyberdrop_dl/scraper/crawlers/bunkrr_crawler.py b/cyberdrop_dl/scraper/crawlers/bunkrr_crawler.py
index d7c68d0ad..87f325152 100644
--- a/cyberdrop_dl/scraper/crawlers/bunkrr_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/bunkrr_crawler.py
@@ -107,7 +107,7 @@ class BunkrrCrawler(Crawler):
if "a" in scrape_item.url.parts:
await self.album(scrape_item)
elif is_cdn(scrape_item.url) and not is_stream_redirect(scrape_item.url):
- await self.handle_direct_link(scrape_item)
+ await self.handle_direct_link(scrape_item, fallback_filename=scrape_item.url.name)
else:
await self.file(scrape_item)
diff --git a/cyberdrop_dl/utils/constants.py b/cyberdrop_dl/utils/constants.py
index 65c985781..0cecfbcac 100644
--- a/cyberdrop_dl/utils/constants.py
+++ b/cyberdrop_dl/utils/constants.py
@@ -8,7 +8,6 @@ from rich.text import Text
CONSOLE_LEVEL = 100
MAX_NAME_LENGTHS = {"FILE": 95, "FOLDER": 60}
DEFAULT_CONSOLE_WIDTH = 240
-RUNNING_PRERELEASE = False
CSV_DELIMITER = ","
LOG_OUTPUT_TEXT = Text("")
RICH_HANDLER_CONFIG = {"show_time": True, "rich_tracebacks": True, "tracebacks_show_locals": False}
diff --git a/cyberdrop_dl/utils/utilities.py b/cyberdrop_dl/utils/utilities.py
index 5af2e9532..6f4be25d0 100644
--- a/cyberdrop_dl/utils/utilities.py
+++ b/cyberdrop_dl/utils/utilities.py
@@ -274,8 +274,9 @@ def check_latest_pypi(log_to_console: bool = True, call_from_ui: bool = False) -
def check_prelease_version(current_version: str, releases: list[str]) -> tuple[bool, str, Text | str]:
match = re.match(constants.PRELEASE_VERSION_PATTERN, current_version)
latest_testing_version = message = ""
+ running_prerelease = next((tag for tag in constants.PRERELEASE_TAGS if tag in current_version), False)
- if constants.RUNNING_PRERELEASE and match:
+ if running_prerelease and match:
major_version, minor_version, patch_version, dot_tag, no_dot_tag = match.groups()
test_tag = dot_tag if dot_tag else no_dot_tag
regex_str = rf"{major_version}\.{minor_version}\.{patch_version}(\.{test_tag}\d+|{test_tag}\d+)"
@@ -289,8 +290,7 @@ def check_prelease_version(current_version: str, releases: list[str]) -> tuple[b
else:
message = f"You are currently on the latest {ui_tag} version of [b cyan]{major_version}.{minor_version}.{patch_version}[/b cyan]"
message = Text.from_markup(message)
-
- return constants.RUNNING_PRERELEASE, latest_testing_version, message
+ return running_prerelease, latest_testing_version, message
async def send_webhook_message(manager: Manager) -> None: