Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: include album id for galleries with the default name (PixHost)

NTFSvolumeafc4775c6273
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 590f6dd49..f86d5e870 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed twitter.com and x.com from blocked domains
- Update primary URL to pixhost.cc (Pixhost)
+- Always include album id in folder name when a gallery's title is "Untitled Gallery" (Pixhost)
### Fixed
diff --git a/cyberdrop_dl/crawlers/pixhost.py b/cyberdrop_dl/crawlers/pixhost.py
index 8c9d49c0d..bb25ec24c 100644
--- a/cyberdrop_dl/crawlers/pixhost.py
+++ b/cyberdrop_dl/crawlers/pixhost.py
@@ -50,6 +50,8 @@ class PixHostCrawler(Crawler):
async def gallery(self, scrape_item: ScrapeItem, album_id: str) -> None:
soup = await self.request_soup(scrape_item.url)
title = css.select_text(soup, Selector.GALLERY_TITLE)
+ if title.casefold() == "untitled gallery" and not self.config.subfolders.include.album_id:
+ title = f"{title} {album_id}"
title = self.create_title(title, album_id)
scrape_item.setup_as_album(title, album_id=album_id)
should_download = await self.make_album_checker(album_id)
diff --git a/tests/crawlers/test_cases/pixhost.py b/tests/crawlers/test_cases/pixhost.py
index b012f6d33..9c7b1f7dd 100644
--- a/tests/crawlers/test_cases/pixhost.py
+++ b/tests/crawlers/test_cases/pixhost.py
@@ -30,7 +30,7 @@ TEST_CASES = [
"filename": "107062500_instasave.jpg",
"referer": "https://pixhost.cc/gallery/pgv5s",
"album_id": "pgv5s",
- "download_path": "re:Untitled Gallery",
+ "download_path": "re:Untitled Gallery pgv5s",
}
],
"count": 7,