Skip to content

Bulk asynchronous downloader for multiple file hosts

feat: support alternative domains (pixeldrain) (#1294)

NTFSvolumea3bfeceaf05e
diff --git a/cyberdrop_dl/crawlers/pixeldrain.py b/cyberdrop_dl/crawlers/pixeldrain.py
index 519cbb6ad..5cb89602b 100644
--- a/cyberdrop_dl/crawlers/pixeldrain.py
+++ b/cyberdrop_dl/crawlers/pixeldrain.py
@@ -3,7 +3,7 @@ from __future__ import annotations
import json
from typing import TYPE_CHECKING, Any, ClassVar
-from cyberdrop_dl.crawlers.crawler import Crawler, SupportedPaths
+from cyberdrop_dl.crawlers.crawler import Crawler, SupportedDomains, SupportedPaths
from cyberdrop_dl.data_structures.url_objects import AbsoluteHttpURL
from cyberdrop_dl.exceptions import DownloadError, NoExtensionError, ScrapeError
from cyberdrop_dl.utils import css, open_graph
@@ -19,6 +19,7 @@ PRIMARY_URL = AbsoluteHttpURL("https://pixeldrain.com")
class PixelDrainCrawler(Crawler):
+ SUPPORTED_DOMAINS: ClassVar[SupportedDomains] = "pd.cybar.xyz", "pixeldrain.com", "pixeldrain.net", "pixeldra.in"
SUPPORTED_PATHS: ClassVar[SupportedPaths] = {"File": "/u/...", "Folder": "/l/..."}
PRIMARY_URL: ClassVar[AbsoluteHttpURL] = PRIMARY_URL
DOMAIN: ClassVar[str] = "pixeldrain"
@@ -67,7 +68,8 @@ class PixelDrainCrawler(Crawler):
if await self.check_complete_from_referer(scrape_item):
return
- api_url = API_ENTRYPOINT / "file" / scrape_item.url.name / "info"
+ file_id = scrape_item.url.name
+ api_url = API_ENTRYPOINT / "file" / file_id / "info"
try:
json_resp: dict[str, Any] = await self.request_json(api_url)
except DownloadError as e:
@@ -92,7 +94,12 @@ class PixelDrainCrawler(Crawler):
filename, ext = self.get_filename_and_ext(f"{filename}.{mime_type.split('/')[-1]}")
- await self.handle_file(link, scrape_item, filename, ext)
+ if scrape_item.url.host == "pd.cybar.xyz":
+ debrid_link = scrape_item.url
+ scrape_item.url = self.PRIMARY_URL / "u" / file_id
+ else:
+ debrid_link = None
+ await self.handle_file(link, scrape_item, filename, ext, debrid_link=debrid_link)
async def text(self, scrape_item: ScrapeItem) -> None:
api_url = API_ENTRYPOINT / "file" / scrape_item.url.parts[-1]