Files
ohm_streaming/FIX_IMPORT_ERROR.md
root 3afad41d46 refactor: Restructure downloaders with clear separation
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>
2026-01-24 22:13:20 +00:00

75 lines
2.1 KiB
Markdown

# 🔧 Correction Import Error - VidMoly
## Problème
Quand on tentait un téléchargement depuis le web avec une URL Anime-Sama qui pointait vers VidMoly:
```
Error extracting AnimeSama link: Error extracting from vidmoly:
No module named 'app.downloaders.anime_sites.vidmoly'
```
## Cause Racine
Après la restructuration, les players vidéo ont été déplacés de `app/downloaders/` vers `app/downloaders/video_players/`, mais `AnimeSamaDownloader` essayait encore d'importer `VidMolyDownloader` depuis `anime_sites/`:
```python
# ❌ Ancien import (ne fonctionne plus)
from .vidmoly import VidMolyDownloader
```
## Solution
Corriger tous les imports de players vidéo dans `AnimeSamaDownloader`:
```python
# ✅ Nouvel import (correct)
from ..video_players.vidmoly import VidMolyDownloader
from ..video_players.sendvid import SendVidDownloader
from ..video_players.sibnet import SibnetDownloader
from ..video_players.lpayer import LpayerDownloader
```
## Fichiers Modifiés
**`app/downloaders/anime_sites/animesama.py`**:
- Ligne 195: `from ..video_players.vidmoly import VidMolyDownloader`
- Ligne 257: `from ..video_players.sendvid import SendVidDownloader`
- Ligne 304: `from ..video_players.sibnet import SibnetDownloader`
- Ligne 401: `from ..video_players.lpayer import LpayerDownloader`
## Vérification
**23/23 tests passants**
**Téléchargement test**: Anime-Sama → VidMoly fonctionne
**API endpoint**: `/api/download` fonctionne correctement
**Imports**: Tous les paths sont corrects
## Tests
```python
# Test d'un téléchargement complet
POST /api/download
{
"url": "https://anime-sama.si/catalogue/naruto/saison1/vostfr/episode-1"
}
# Réponse: 200 OK
{
"task_id": "...",
"status": "pending",
...
}
```
## Autres Sites Anime
**NekoSama**: Aucun import de video player (OK)
**AnimeUltime**: Aucun import de video player (OK)
**Vostfree**: Aucun import de video player (OK)
Seul `AnimeSama` utilise des imports directs de video players.
---
**Statut**: ✅ Corrigé et testé
**Impact**: Le téléchargement depuis le web fonctionne maintenant