Skip to content

Bulk asynchronous downloader for multiple file hosts

Keep parenthesis domain in title regardless of length.

Jules-WinnfieldXbdb7e5a31a76
diff --git a/cyberdrop_dl/utils/utilities.py b/cyberdrop_dl/utils/utilities.py
index a379b171b..b873a1e55 100644
--- a/cyberdrop_dl/utils/utilities.py
+++ b/cyberdrop_dl/utils/utilities.py
@@ -108,7 +108,14 @@ async def sanitize_folder(title: str) -> str:
title = re.sub(' +', ' ', title)
title = re.sub(r'[\\*?:"<>|/]', "-", title)
title = re.sub(r'\.{2,}', ".", title)
- title = title[:MAX_NAME_LENGTHS['FOLDER']].strip()
+
+ if "(" in title and ")" in title:
+ new_title = title.rsplit("(")[0].strip()
+ new_title = new_title[:MAX_NAME_LENGTHS['FOLDER']].strip()
+ domain_part = title.rsplit("(")[1].strip()
+ title = f"{new_title} ({domain_part}"
+ else:
+ title = title[:MAX_NAME_LENGTHS['FOLDER']].strip()
return title