Download MP3s from YouTube playlists with FastAPI backend and web interface
Project description
FetchYT ๐ต
Download MP3s from YouTube playlists with a modern web interface and CLI tool.
Features
- ๐ฅ Download MP3s from YouTube videos and playlists
- ๐ Web Interface with dark mode design
- ๐ฅ๏ธ CLI Tool for terminal usage
- ๐ FastAPI Backend for scalability
- ๐ฆ Easy Installation via PyPI
- ๐จ Multiple Format Support (MP3, M4A, WAV)
- โก Quality Options (128, 192, 256, 320 kbps)
Installation
From PyPI
# Using uv (recommended - faster)
uv pip install fetchyt
# Or using pip
pip install fetchyt
From Source
git clone https://gitlab.com/allikapub/fetchyt.git
cd fetchyt
# Using uv (recommended)
uv pip install -e .
# Or using pip
pip install -e .
Development Setup
# Clone the repository
git clone https://gitlab.com/allikapub/fetchyt.git
cd fetchyt
# Using uv (recommended - much faster)
uv venv
source .venv/bin/activate # Linux/macOS
.venv\Scripts\activate # Windows
uv pip install -e ".[dev]"
# Or using pip
pip install -e ".[dev]"
Quick Start
CLI Usage
# Download a single video
fetchyt download "https://www.youtube.com/watch?v=VIDEO_ID"
# Download a playlist
fetchyt download "https://www.youtube.com/playlist?list=PLAYLIST_ID"
# Download with custom quality and format
fetchyt download "URL" --format m4a --quality 320
# Get information without downloading
fetchyt info "URL"
# Start web server
fetchyt server --port 8098
Web Interface
Start the web server:
fetchyt server
Then open your browser and navigate to http://localhost:8098
Python API
import asyncio
from fetchyt import YouTubeDownloader
async def main():
downloader = YouTubeDownloader()
# Extract information
videos = await downloader.extract_info("YOUTUBE_URL")
print(f"Found {len(videos)} videos")
# Download
task_id = await downloader.download(
url="YOUTUBE_URL",
format="mp3",
quality="192"
)
print(f"Download started: {task_id}")
asyncio.run(main())
CLI Commands
Download Command
fetchyt download <URL> [OPTIONS]
Options:
-f, --format Audio format: mp3, m4a, wav (default: mp3)
-q, --quality Audio quality: 128, 192, 256, 320 kbps (default: 192)
-o, --output Output directory (default: ./downloads)
-y, --yes Skip confirmation prompt
Info Command
fetchyt info <URL>
Get information about videos without downloading.
Cookies Command
Extract YouTube cookies directly from your browser to bypass bot detection:
# Chrome/Chromium
fetchyt cookies --browser chrome --output cookies.txt
# Firefox
fetchyt cookies --browser firefox --output cookies.txt
# Use the cookies in FetchYT
# PowerShell (Windows)
$env:COOKIES_FILE = "./cookies.txt"
# bash (Linux/macOS)
export COOKIES_FILE=./cookies.txt
# Then run
fetchyt info "<URL>"
fetchyt download "<URL>"
Server Command
print(f"Download started: {task_id}")
asyncio.run(main()) Options: --host Server host (default: 0.0.0.0) --port Server port (default: 8098)
## API Endpoints
When running as a server, FetchYT provides the following REST API endpoints:
- `GET /` - Web interface
- `POST /api/v1/extract` - Extract video/playlist information
- `POST /api/v1/download` - Start download
- `GET /api/v1/status/{task_id}` - Check download status
- `DELETE /api/v1/task/{task_id}` - Cleanup completed task
- `GET /health` - Health check endpoint
- `GET /docs` - Interactive API documentation
## Using uv (Recommended)
This project supports **uv**, a blazingly fast Python package installer (10-100x faster than pip). The setup scripts will automatically install and use uv. For detailed uv usage, see [UV_GUIDE.md](UV_GUIDE.md).
## Configuration
FetchYT can be configured using environment variables:
```bash
# API Configuration
export API_HOST=0.0.0.0
export API_PORT=8098
# Download Configuration
export DOWNLOAD_DIR=./downloads
export MAX_CONCURRENT_DOWNLOADS=3
export COOKIES_FILE=./cookies.txt # Optional: path to exported browser cookies
# Debug Mode
export DEBUG=True
Project Structure
fetchyt/
โโโ fetchyt/
โ โโโ __init__.py # Package initialization
โ โโโ api.py # FastAPI application
โ โโโ cli.py # Command-line interface
โ โโโ config.py # Configuration settings
โ โโโ downloader.py # YouTube downloader core
โ โโโ models.py # Data models
โ โโโ static/ # Web interface
โ โโโ index.html
โ โโโ css/
โ โ โโโ style.css
โ โโโ js/
โ โโโ app.js
โโโ pyproject.toml # Project configuration
โโโ requirements.txt # Dependencies
โโโ LICENSE # MIT License
โโโ README.md # This file
Requirements
- Python 3.12+
- FFmpeg (for audio conversion)
- uv (recommended) or pip for package management
- yt-dlp (installed automatically as a dependency)
Troubleshooting (YouTube bot detection)
If you see an error like "Sign in to confirm youโre not a bot":
- Extract cookies from your browser and set
COOKIES_FILE(see Cookies Command above) - Wait 10โ30 minutes and try again (temporary rate limits)
- Try a different network or a VPN
- Use a different browser to export cookies
Learn more: https://github.com/yt-dlp/yt-dlp/wiki/Extractors#exporting-youtube-cookies
Installing uv (Recommended)
uv is a blazingly fast Python package installer and resolver:
Windows (PowerShell):
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
Linux/macOS:
curl -LsSf https://astral.sh/uv/install.sh | sh
Learn more: https://github.com/astral-sh/uv
Installing FFmpeg
Windows:
# Using Chocolatey
choco install ffmpeg
# Or download from https://ffmpeg.org/download.html
macOS:
brew install ffmpeg
Linux:
# Ubuntu/Debian
sudo apt update && sudo apt install ffmpeg
# Fedora
sudo dnf install ffmpeg
# Arch
sudo pacman -S ffmpeg
Development
Running Tests
pytest
Publishing to PyPI
Prerequisites
- Install build tools:
pip install build twine
Build and Upload
# Build the package
python -m build
# Upload to TestPyPI (for testing)
python -m twine upload --repository testpypi dist/*
# Upload to PyPI (production)
python -m twine upload dist/*
Roadmap
- Resume interrupted downloads
- Batch download from file
- Download queue management
- Progress notifications
- Subtitle download support
- Video format support
- Playlist filtering options
- Docker support
- Desktop application (Electron/Tauri)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. See LICENSE for details.
Disclaimer
This tool is for personal use only. Please respect YouTube's Terms of Service and copyright laws. Always ensure you have the right to download content.
Acknowledgments
- yt-dlp - The powerful YouTube downloader
- FastAPI - Modern web framework
- FFmpeg - Multimedia framework
Support
If you encounter any issues or have questions:
- ๐ Report a bug
- ๐ก Request a feature
- ๐ฌ Start a discussion
Made with โค๏ธ by the FetchYT team
Copyright (c) 2026 Krishnakanth Allika. All rights reserved.
Licensed under CC-BY-NC-SA-4.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fetchyt-0.1.1.tar.gz.
File metadata
- Download URL: fetchyt-0.1.1.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cbfa6c4ca7c9f7ffa79a302af1070b19d87920b07cb0de3796abc2d97dc8ce2
|
|
| MD5 |
ba1763d61820374980747c7a21c797ac
|
|
| BLAKE2b-256 |
693775b04344d94a577224a2e6d8da8cfda0fba6b548a34b04ba2c18a909fa47
|
File details
Details for the file fetchyt-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fetchyt-0.1.1-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66c953bba5118178427add2b81c87e4ee5e805d312ae504484e10baa4d576d2b
|
|
| MD5 |
08adedef9f319e6584d5cbb1e5643c7f
|
|
| BLAKE2b-256 |
f47d7fcc9e34aeb4fd49ed1d9bb0f7038159a11af540511865e20966c7ebe86b
|