Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: do not re-add domain name on subfolders (#1219)

NTFSvolumec72e5fd48cdc
diff --git a/cyberdrop_dl/data_structures/url_objects.py b/cyberdrop_dl/data_structures/url_objects.py
index ee9459915..5db2e02bc 100644
--- a/cyberdrop_dl/data_structures/url_objects.py
+++ b/cyberdrop_dl/data_structures/url_objects.py
@@ -256,6 +256,19 @@ class ScrapeItem:
if not title or self.retry:
return
title = sanitize_folder(title)
+
+ for part in reversed(self.parent_title.split("/")):
+ if part.endswith(")") and " (" in part:
+ last_domain_suffix = part.rpartition(" (")[-1]
+ break
+ else:
+ last_domain_suffix = None
+
+ if last_domain_suffix and title.endswith(")") and " (" in title:
+ og_title, _, domain_suffix = title.rpartition(" (")
+ if last_domain_suffix == domain_suffix:
+ title = og_title
+
self.parent_title = (self.parent_title + "/" + title) if self.parent_title else title
def set_type(self, scrape_item_type: ScrapeItemType | None, _: Manager | None = None) -> None: