Skip to content

Bulk asynchronous downloader for multiple file hosts

feat: add support for fatbox proxy (Catbox) (#1911)

NTFSvolume073321f4e5d8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6488a013..94fed94f7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Soundgasm support
- Clyp.it support
- Livestreamfails support
+- Fatbox proxy support (Catbox)
### Changed
diff --git a/cyberdrop_dl/crawlers/catbox.py b/cyberdrop_dl/crawlers/catbox.py
index 60decfd4b..73dce5ce3 100644
--- a/cyberdrop_dl/crawlers/catbox.py
+++ b/cyberdrop_dl/crawlers/catbox.py
@@ -9,18 +9,17 @@ if TYPE_CHECKING:
from cyberdrop_dl.url_objects import ScrapeItem
-PRIMARY_URL = AbsoluteHttpURL("https://catbox.moe")
-CDN_HOSTS = "litter.catbox.moe", "files.catbox.moe"
+_CDN_HOSTS = "litter.catbox.moe", "files.catbox.moe", "litter.fatbox.moe", "files.fatbox.moe"
class CatboxCrawler(Crawler):
- SUPPORTED_DOMAINS: ClassVar[SupportedDomains] = CDN_HOSTS
+ SUPPORTED_DOMAINS: ClassVar[SupportedDomains] = _CDN_HOSTS
SUPPORTED_PATHS: ClassVar[SupportedPaths] = {"Direct links": ""}
- PRIMARY_URL: ClassVar[AbsoluteHttpURL] = PRIMARY_URL
+ PRIMARY_URL: ClassVar[AbsoluteHttpURL] = AbsoluteHttpURL("https://catbox.moe")
DOMAIN: ClassVar[str] = "catbox.moe"
FOLDER_DOMAIN: ClassVar[str] = "Catbox"
async def fetch(self, scrape_item: ScrapeItem) -> None:
- if any(p == scrape_item.url.host for p in CDN_HOSTS):
+ if scrape_item.url.host in _CDN_HOSTS:
return await self.direct_file(scrape_item, assume_ext=".zip")
raise ValueError
diff --git a/tests/crawlers/test_cases/catbox_moe.py b/tests/crawlers/test_cases/catbox_moe.py
new file mode 100644
index 000000000..0849ad09a
--- /dev/null
+++ b/tests/crawlers/test_cases/catbox_moe.py
@@ -0,0 +1,35 @@
+DOMAIN = "catbox.moe"
+TEST_CASES = [
+ {
+ "url": "https://files.catbox.moe/ey8s2h.zip",
+ "results": [
+ {
+ "url": "https://files.catbox.moe/ey8s2h.zip",
+ "filename": "ey8s2h.zip",
+ "debrid_link": None,
+ "original_filename": "ey8s2h.zip",
+ "referer": "https://files.catbox.moe/ey8s2h.zip",
+ "album_id": None,
+ "uploaded_at": None,
+ "download_folder": "re:Loose Files (Catbox)",
+ }
+ ],
+ "count": 1,
+ },
+ {
+ "url": "https://files.fatbox.moe/ey8s2h.zip",
+ "results": [
+ {
+ "url": "https://files.fatbox.moe/ey8s2h.zip",
+ "filename": "ey8s2h.zip",
+ "debrid_link": None,
+ "original_filename": "ey8s2h.zip",
+ "referer": "https://files.fatbox.moe/ey8s2h.zip",
+ "album_id": None,
+ "uploaded_at": None,
+ "download_folder": "re:Loose Files (Catbox)",
+ }
+ ],
+ "count": 1,
+ },
+]