Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: support wiki site override
NTFSvolume298469c844ae
diff --git a/cyberdrop_dl/commands/supported_sites.py b/cyberdrop_dl/commands/supported_sites.pyindex c5ab3e24e..8a597a301 100644--- a/cyberdrop_dl/commands/supported_sites.py+++ b/cyberdrop_dl/commands/supported_sites.py@@ -19,7 +19,7 @@ def _gen_crawlers_info() -> list[CrawlerInfo]:def as_json() -> dict[str, dict[str, Any]]:- return {info.site: info.__json__() for info in _gen_crawlers_info()}+ return {info.wiki_site or info.site: info.__json__() for info in _gen_crawlers_info()}def as_rich_json() -> JSON:@@ -42,7 +42,7 @@ def as_rich_table() -> Table:for crawler_info in _gen_crawlers_info():table.add_row(- crawler_info.site,+ crawler_info.wiki_site or crawler_info.site,str(crawler_info.primary_url),"\n".join(crawler_info.supported_domains),)@@ -69,7 +69,7 @@ def _generate_md_blocks(indent_level: int) -> Generator[str]:for info in _gen_crawlers_info():url = str(info.primary_url).rstrip("/")lines = [- f"{'#' * (indent_level + 1)} {info.site}",+ f"{'#' * (indent_level + 1)} {info.wiki_site or info.site}","",f"**Primary URL**: [{url}]({url})","",diff --git a/cyberdrop_dl/crawlers/crawler.py b/cyberdrop_dl/crawlers/crawler.pyindex 5ea25ac15..f1ee6ffbd 100644--- a/cyberdrop_dl/crawlers/crawler.py+++ b/cyberdrop_dl/crawlers/crawler.py@@ -117,6 +117,7 @@ class CrawlerInfo:scrape_mapper_keys: tuple[str, ...]supported_domains: tuple[str, ...]supported_paths: dict[str, tuple[str, ...]]+ wiki_site: str | None = None__iter__ = DictDataclass.__iter__@@ -306,7 +307,13 @@ class Crawler(HTTPMixin, HLSMixin, ABC):This method its called once and only if the crawler is actually going to be scrape something"""def __init_subclass__(- cls, *, is_abc: bool = False, is_generic: bool = False, is_debug: bool = False, **kwargs: Any+ cls,+ *,+ is_abc: bool = False,+ is_generic: bool = False,+ is_debug: bool = False,+ wiki_site: str | None = None,+ **kwargs: Any,) -> None:assert cls.__name__.endswith("Crawler"), f"{cls.__name__} does not end with 'Crawler'"assert cls.__name__ not in Registry.names@@ -353,6 +360,7 @@ class Crawler(HTTPMixin, HLSMixin, ABC):supported_domains=_make_wiki_supported_domains(scrape_keys),scrape_mapper_keys=scrape_keys,supported_paths=paths,+ wiki_site=wiki_site or cls.FOLDER_DOMAIN,)if add_to_registry:Registry.concrete.add(cls)diff --git a/cyberdrop_dl/crawlers/fileditch.py b/cyberdrop_dl/crawlers/fileditch.pyindex 7dc025b01..125faef5e 100644--- a/cyberdrop_dl/crawlers/fileditch.py+++ b/cyberdrop_dl/crawlers/fileditch.py@@ -119,7 +119,7 @@ class File:@FileditchCrawler.__http_config__-class FileditchAlbumsCrawler(Crawler):+class FileditchAlbumsCrawler(Crawler, wiki_site="FileditchAlbums"):# Keep this as a separate class. Site changes domains frequently# Let the scrape mapper dispatch to the best matching domainSUPPORTED_PATHS: ClassVar[SupportedPaths] = {diff --git a/cyberdrop_dl/crawlers/reddit/crawler.py b/cyberdrop_dl/crawlers/reddit/crawler.pyindex fdbab6e6d..2e871480b 100644--- a/cyberdrop_dl/crawlers/reddit/crawler.py+++ b/cyberdrop_dl/crawlers/reddit/crawler.py@@ -21,7 +21,7 @@ if TYPE_CHECKING:@Crawler.db_path_builder("url")-class RedditImagesCrawler(Crawler):+class RedditImagesCrawler(Crawler, wiki_site="RedditImages"):SUPPORTED_DOMAINS: ClassVar[SupportedDomains] = "preview.redd.it", "external-preview.redd.it", "i.redd.it"SUPPORTED_PATHS: ClassVar[SupportedPaths] = {"Image": "i.redd.it/<id>.>ext>"}PRIMARY_URL: ClassVar[AbsoluteHttpURL] = AbsoluteHttpURL("https://i.redd.it")@@ -56,7 +56,7 @@ class RedditImagesCrawler(Crawler):@Crawler.db_path_builder("url")-class RedditVideoCrawler(Crawler):+class RedditVideoCrawler(Crawler, wiki_site="RedditVideos"):SUPPORTED_PATHS: ClassVar[SupportedPaths] = {"Video": "v.redd.it/<video_id>"}PRIMARY_URL: ClassVar[AbsoluteHttpURL] = AbsoluteHttpURL("https://v.redd.it")DOMAIN: ClassVar[str] = "v.redd.it"diff --git a/cyberdrop_dl/crawlers/vk/vk.py b/cyberdrop_dl/crawlers/vk/vk.pyindex 2d22125c0..0196e5a8a 100644--- a/cyberdrop_dl/crawlers/vk/vk.py+++ b/cyberdrop_dl/crawlers/vk/vk.py@@ -129,7 +129,7 @@ class VKBaseCrawler(Crawler, is_abc=True):return url-class VKVideoCrawler(VKBaseCrawler):+class VKVideoCrawler(VKBaseCrawler, wiki_site="VKVideo"):SUPPORTED_PATHS: ClassVar[SupportedPaths] = VKBaseCrawler.SUPPORTED_PATHS | {"User / Group videos": ("@<owner_screen_name>",@@ -246,7 +246,7 @@ class VKVideoCrawler(VKBaseCrawler):@URLConfig(allow_empty_path=True)-class VKCrawler(VKBaseCrawler):+class VKCrawler(VKBaseCrawler, wiki_site="VK"):SUPPORTED_DOMAINS: ClassVar[SupportedDomains] = ("vk.ru", "vk.com", ".userapi.com", "vk.me")SUPPORTED_PATHS: ClassVar[SupportedPaths] = VKBaseCrawler.SUPPORTED_PATHS | {"User / Group wall": (