A high-performance, asynchronous anime scraper and downloader. This project transitions from legacy synchronous architecture to a modern, decoupled, and scalable ecosystem using FastAPI for the backend.
- Modular Architecture: Cleanly separated API, extraction, and download layers.
- High Performance: Built with
asyncioandhttpxfor non-blocking network I/O. - Dual-Engine Download System:
aria2cfor fast, efficient static file downloads.ffmpegfor robust HLS/M3U8 stream processing and stitching.
- Resilient Scraping: Built-in JSON-based caching and dynamic User-Agent rotation.
- Unified API: A clean RESTful interface for all functionality (search, stream resolution, download management).
anime_downloader/
├── api/ # FastAPI Backend (Endpoints)
├── core/ # Shared logic, config, cache, logging
├── downloader/ # Download engines (aria2c/ffmpeg)
├── extractors/ # Async scraping logic (Provider interface)
├── tests/ # Test suite (pytest)
└── requirements.txt # Project dependencies
- Python 3.12+
- aria2c: Installed and available in PATH.
- ffmpeg: Installed and available in PATH.
# Clone the repository
git clone https://github.com/AliHaSSan-13/AnimeKAI-API
cd Anime_Downloader
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txtSet up your aria2c daemon:
aria2c --enable-rpc --rpc-listen-port=6800 --rpc-secret=YOUR_SECRET_TOKEN --daemonAlways run the application from the project root directory.
Start the API:
python -m uvicorn api.main:app --port 8000Access the API documentation at http://localhost:8000/docs once the server is running.
Run the test suite using pytest:
python -m pytestThis software is for educational purposes only. Always respect the Terms of Service of the content providers. The author takes no responsibility for how this tool is used.
This project is licensed under the MIT License - see the LICENSE file for details.