Skip to content

Bulk asynchronous downloader for multiple file hosts

fix: separate post formating (#1074)

NTFSvolume0b3842774560
diff --git a/cyberdrop_dl/config/config_model.py b/cyberdrop_dl/config/config_model.py
index f38d4616f..c3c70df9e 100755
--- a/cyberdrop_dl/config/config_model.py
+++ b/cyberdrop_dl/config/config_model.py
@@ -45,6 +45,16 @@ class DownloadOptions(BaseModel):
skip_referer_seen_before: bool = False
maximum_thread_depth: NonNegativeInt = 0
+ @field_validator("separate_posts_format", mode="after")
+ @classmethod
+ def valid_format(cls, value: str) -> str:
+ valid_keys = ("default", "title", "id", "number", "date")
+ try:
+ value.format(**dict.fromkeys(valid_keys, "TEST"))
+ except KeyError as e:
+ msg = f"'{e.args[0]}' is not a valid key for this option. Valid keys: {valid_keys}"
+ raise ValueError(msg) from None
+
class Files(PathAliasModel):
download_folder: Path = Field(DEFAULT_DOWNLOAD_STORAGE, "d")
diff --git a/cyberdrop_dl/crawlers/crawler.py b/cyberdrop_dl/crawlers/crawler.py
index 53bb28eff..44b18f42a 100644
--- a/cyberdrop_dl/crawlers/crawler.py
+++ b/cyberdrop_dl/crawlers/crawler.py
@@ -371,7 +371,7 @@ class Crawler(ABC):
id = default_if_none(id, "Unknown")
title = default_if_none(title, "Untitled")
date_str = default_if_none(date_str, "NO_DATE")
- return title_format.format(id=id, date=date_str, title=title)
+ return title_format.format(id=id, number=id, date=date_str, title=title)
def parse_url(self, link_str: str, relative_to: URL | None = None, *, trim: bool = True) -> AbsoluteHttpURL:
"""Wrapper arround `utils.parse_url` to use `self.PRIMARY_URL` as base"""