from .base import BaseDownloader from .unfichier import UnFichierDownloader from .doodstream import DoodStreamDownloader from .rapidfile import RapidFileDownloader from .uptobox import UptoboxDownloader from .animesama import AnimeSamaDownloader from .animeultime import AnimeUltimeDownloader from .nekosama import NekoSamaDownloader from .vostfree import VostfreeDownloader from .vidmoly import VidMolyDownloader from .sendvid import SendVidDownloader def get_downloader(url: str) -> BaseDownloader: """Factory function to get the appropriate downloader for a URL""" downloaders = [ # Anime sites AnimeSamaDownloader(), AnimeUltimeDownloader(), NekoSamaDownloader(), VostfreeDownloader(), # File hosts UnFichierDownloader(), UptoboxDownloader(), DoodStreamDownloader(), RapidFileDownloader(), VidMolyDownloader(), SendVidDownloader(), ] for downloader in downloaders: if downloader.can_handle(url): return downloader # Return generic downloader if no match return GenericDownloader() class GenericDownloader(BaseDownloader): """Generic downloader for unhandled hosts""" def can_handle(self, url: str) -> bool: return True async def get_download_link(self, url: str) -> tuple[str, str]: # Just return the URL as-is filename = url.split('/')[-1] or "download" return url, filename