from .base import BaseDownloader # Import from new organized structure from .video_players import ( BaseVideoPlayer, get_video_player, DoodStreamDownloader, SibnetDownloader, VidMolyDownloader, SendVidDownloader, LpayerDownloader, UnFichierDownloader, UptoboxDownloader, RapidFileDownloader ) from .anime_sites import ( BaseAnimeSite, get_anime_site, AnimeSamaDownloader, NekoSamaDownloader, AnimeUltimeDownloader, VostfreeDownloader ) def get_downloader(url: str) -> BaseDownloader: """ Factory function to get the appropriate downloader for a URL. This function now uses the organized structure: - Checks anime sites first (for catalogs/search) - Then checks video players (for direct download links) - Falls back to generic downloader if no match """ # Try anime sites first anime_site = get_anime_site(url) if anime_site: return anime_site # Then try video players video_player = get_video_player(url) if video_player: return video_player # 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