3afad41d46
This commit implements a complete reorganization of the downloader system with a clear distinction between anime streaming sites and video hosting services. ## Structure Changes **New Organization:** - `app/downloaders/anime_sites/` - Anime streaming sites (catalogs + metadata) - `app/downloaders/video_players/` - Video hosting services (file downloads) **Base Classes:** - `BaseAnimeSite` - For anime providers (search, episodes, metadata) - `BaseVideoPlayer` - For video players (download link extraction) **Migrated Downloaders:** Anime Sites (4): - AnimeSama, NekoSama, AnimeUltime, Vostfree Video Players (8): - Doodstream, Sibnet, VidMoly, SendVid, Lpayer, 1fichier, Uptobox, Rapidfile ## Key Improvements 1. **Clear Separation**: Distinct base classes for different use cases 2. **Preserved Functionality**: All existing features maintained - VidMoly: M3U8 support, Playwright, multi-domains, target_filename param - SendVid: target_filename parameter support - All others: No behavioral changes 3. **Better Organization**: - Anime sites: search_anime(), get_episodes(), get_anime_metadata() - Video players: get_download_link(url, target_filename=None) 4. **Fixed Imports**: Updated cross-imports in AnimeSama - from ..video_players.vidmoly import - from ..video_players.sendvid import - from ..video_players.sibnet import - from ..video_players.lpayer import 5. **Updated Tests**: All test imports use new structure 6. **Updated Providers**: Added 4 missing file hosts to providers.py ## Backward Compatibility ✅ Main API unchanged: get_downloader() works identically ✅ All 23 tests passing ✅ Frontend fully functional ✅ No breaking changes for users ## Documentation - RESTRUCTURATION_SUMMARY.md - Technical details - FIX_IMPORT_ERROR.md - Import error resolution - IMPORT_VERIFICATION_REPORT.md - Complete import verification - FRONTEND_VERIFICATION_FINAL.md - Frontend validation Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
107 lines
3.1 KiB
Python
107 lines
3.1 KiB
Python
"""Anime and file hosting providers configuration"""
|
|
|
|
ANIME_PROVIDERS = {
|
|
"anime-sama": {
|
|
"name": "Anime-Sama",
|
|
"domains": ["anime-sama.si", "www.anime-sama.si", "anime-sama.org", "anime-sama.store", "anime-sama.eu"],
|
|
"url_pattern": "https://anime-sama.si/catalogue/{anime}/saison{season}/{lang}/",
|
|
"icon": "🎬",
|
|
"color": "#00d9ff"
|
|
},
|
|
"anime-ultime": {
|
|
"name": "Anime-Ultime",
|
|
"domains": ["anime-ultime.net", "anime-ultime.com", "www.anime-ultime.net"],
|
|
"url_pattern": "https://www.anime-ultime.net/info-{id}-{slug}",
|
|
"icon": "▶️",
|
|
"color": "#00ff88"
|
|
},
|
|
"neko-sama": {
|
|
"name": "Neko-Sama",
|
|
"domains": ["neko-sama.fr", "nekosama.fr", "www.neko-sama.fr"],
|
|
"url_pattern": "https://neko-sama.fr/anime/{slug}",
|
|
"icon": "🐱",
|
|
"color": "#ff6b6b"
|
|
},
|
|
"vostfree": {
|
|
"name": "Vostfree",
|
|
"domains": ["vostfree.tv", "www.vostfree.tv"],
|
|
"url_pattern": "https://vostfree.tv/anime/{slug}",
|
|
"icon": "📺",
|
|
"color": "#ffd93d"
|
|
}
|
|
}
|
|
|
|
FILE_HOSTS = {
|
|
"1fichier": {
|
|
"name": "1fichier",
|
|
"domains": ["1fichier.com", "1fichier.fr"],
|
|
"icon": "📁",
|
|
"color": "#4ecdc4"
|
|
},
|
|
"uptobox": {
|
|
"name": "Uptobox",
|
|
"domains": ["uptobox.com", "uptobox.fr"],
|
|
"icon": "📦",
|
|
"color": "#45b7d1"
|
|
},
|
|
"doodstream": {
|
|
"name": "Doodstream",
|
|
"domains": ["doodstream.com", "dood.stream", "dood.to", "dood.lol", "dood.cx", "dood.so", "dood.watch", "dood.sh"],
|
|
"icon": "🎥",
|
|
"color": "#f7b731"
|
|
},
|
|
"rapidfile": {
|
|
"name": "Rapidfile",
|
|
"domains": ["rapidfile.net", "rapidfile.com"],
|
|
"icon": "⚡",
|
|
"color": "#ff6b6b"
|
|
},
|
|
"vidmoly": {
|
|
"name": "VidMoly",
|
|
"domains": ["vidmoly.to", "vidmoly.org", "vidmoly.biz"],
|
|
"icon": "🎬",
|
|
"color": "#a29bfe"
|
|
},
|
|
"sendvid": {
|
|
"name": "SendVid",
|
|
"domains": ["sendvid.com", "sendvid.io"],
|
|
"icon": "📤",
|
|
"color": "#fd79a8"
|
|
},
|
|
"sibnet": {
|
|
"name": "Sibnet",
|
|
"domains": ["sibnet.ru", "video.sibnet.ru"],
|
|
"icon": "🎞️",
|
|
"color": "#00cec9"
|
|
},
|
|
"lpayer": {
|
|
"name": "Lplayer",
|
|
"domains": ["lpayer.embed4me.com", "lpayer.com", "lplayer.fr"],
|
|
"icon": "▶️",
|
|
"color": "#e17055"
|
|
}
|
|
}
|
|
|
|
def get_all_providers():
|
|
"""Get all supported providers (anime + file hosts)"""
|
|
return {**ANIME_PROVIDERS, **FILE_HOSTS}
|
|
|
|
def get_anime_providers():
|
|
"""Get all anime streaming providers"""
|
|
return ANIME_PROVIDERS
|
|
|
|
def get_file_hosts():
|
|
"""Get all file hosting providers"""
|
|
return FILE_HOSTS
|
|
|
|
def detect_provider_from_url(url: str) -> str | None:
|
|
"""Detect which provider can handle the given URL"""
|
|
url_lower = url.lower()
|
|
|
|
for provider_id, provider in get_all_providers().items():
|
|
for domain in provider['domains']:
|
|
if domain in url_lower:
|
|
return provider_id
|
|
|
|
return None
|