Skip to content

Bulk asynchronous downloader for multiple file hosts

feat: add vidara support (#50)

NTFSvolume8703f95bb4ee
diff --git a/cyberdrop_dl/crawlers/__init__.py b/cyberdrop_dl/crawlers/__init__.py
index 517f5211c..a34babaea 100644
--- a/cyberdrop_dl/crawlers/__init__.py
+++ b/cyberdrop_dl/crawlers/__init__.py
@@ -137,6 +137,7 @@ from .txxx import TXXXCrawler
from .upload_ee import UploadEECrawler
from .upornia import UPorniaCrawler
from .vbulletin import VBULLETIN_CRAWLERS
+from .vidara import VidaraCrawler
from .vipr_dot_im import ViprImCrawler
from .vjav import VJavCrawler
from .voe_sx import VoeSxCrawler
diff --git a/cyberdrop_dl/crawlers/vidara.py b/cyberdrop_dl/crawlers/vidara.py
new file mode 100644
index 000000000..48debff86
--- /dev/null
+++ b/cyberdrop_dl/crawlers/vidara.py
@@ -0,0 +1,53 @@
+from __future__ import annotations
+
+from pathlib import Path
+from typing import TYPE_CHECKING, ClassVar
+
+from cyberdrop_dl.crawlers.crawler import Crawler, DBPathBuilder, SupportedPaths
+from cyberdrop_dl.data_structures.url_objects import AbsoluteHttpURL
+from cyberdrop_dl.utils.utilities import error_handling_wrapper
+
+if TYPE_CHECKING:
+ from cyberdrop_dl.data_structures.url_objects import ScrapeItem
+
+
+class VidaraCrawler(Crawler):
+ SUPPORTED_PATHS: ClassVar[SupportedPaths] = {"Video": "/e/<video_id>"}
+ DOMAIN: ClassVar[str] = "vidara"
+ PRIMARY_URL: ClassVar[AbsoluteHttpURL] = AbsoluteHttpURL("https://vidara.to")
+ create_db_path = staticmethod(DBPathBuilder.path_qs_frag)
+
+ async def fetch(self, scrape_item: ScrapeItem) -> None:
+ match scrape_item.url.parts[1:]:
+ case ["e", video_id]:
+ return await self.video(scrape_item, video_id)
+ case _:
+ raise ValueError
+
+ @error_handling_wrapper
+ async def video(self, scrape_item: ScrapeItem, video_id: str) -> None:
+ if await self.check_complete_from_referer(scrape_item):
+ return
+
+ api_url = (scrape_item.url.origin() / "api/stream").with_query(filecode=video_id)
+ resp = await self.request_json(api_url)
+ m3u8_url = self.parse_url(resp["streaming_url"])
+
+ m3u8, info = await self.get_m3u8_from_playlist_url(m3u8_url)
+ name, ext = self.get_filename_and_ext(video_id + ".mp4")
+ custom_filename = self.create_custom_filename(name, ext, resolution=info.resolution)
+
+ await self.handle_file(scrape_item.url, scrape_item, name, ext, m3u8=m3u8, custom_filename=custom_filename)
+
+ thumbnail = self.parse_url(resp["thumbnail"])
+ thumb_name = f"{Path(custom_filename).stem}_thumb{thumbnail.suffix}"
+ filename, _ = self.get_filename_and_ext(thumb_name)
+ await self.handle_file(
+ referer := scrape_item.url.with_fragment("thumbnail"),
+ scrape_item,
+ thumb_name,
+ thumbnail.suffix,
+ custom_filename=filename,
+ debrid_link=thumbnail,
+ referer=referer,
+ )