Developed with precision by Alperen SΓΌmeroΔlu β turning YouTube audio into clean, downloadable MP3s with elegance.
A high-performance Flask API that transforms any public YouTube video into a high-quality MP3 audio file β instantly, securely, and reliably. Powered by yt-dlp
and FFmpeg
, this API handles downloading, conversion, and secure delivery through expiring token-based access. Designed for developers, content tools, automation pipelines, and all who need clean audio from video sources β fast.
- Features
- Installation
- Example Usage
- API Endpoints
- Internals (How It Works)
- Tech Stack
- Ideal For
- Author
- Weekly Rewind
- License
- π Accepts any public YouTube URL
- π΅ Downloads best audio using
yt-dlp
- β¨ Converts audio to high-quality
.mp3
viaFFmpeg
- π Returns a one-time secure token to download the file
- β±οΈ Tokens expire automatically (default: 5 mins)
- π§Ή Expired files are auto-deleted (clean disk usage)
- π Built for fast local or cloud deployment
Required packages are listed in requirements.txt
. To install all of them simply run:
pip install -r requirements.txt
Make sure FFmpeg is installed on your system:
# macOS
brew install ffmpeg
# Ubuntu/Debian
sudo apt install ffmpeg
Clone and run the project:
git clone https://github.com/alperensumeroglu/yt-audio-api.git
cd yt-audio-api
python3 main.py
GET /?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ
Response:
{
"token": "CGIroH6G-8JDL3DllsUhM6_CfYc"
}
GET /download?token=CGIroH6G-8JDL3DllsUhM6_CfYc
Result: yourfile.mp3
will download automatically πΆ
Method | Route | Description |
---|---|---|
GET | / |
Accepts ?url=<video_url> , returns token |
GET | /download |
Accepts ?token=<token> , returns audio file |
- Downloads audio using
yt-dlp
- Converts it to
.mp3
using FFmpeg (192kbps) - Stores audio in
/downloads
directory - Generates expiring token for each file
- A background daemon removes expired tokens/files
- Python 3.8+
- Flask 2.x
- yt-dlp
- FFmpeg
- Developers building podcast/audio tools
- Automation pipelines for archiving
- Students & hobbyists learning API development
Alperen SΓΌmeroΔlu
Computer Engineer β’ Entrepreneur β’ Global Explorer π
15+ European countries explored
βLet your code be as clean as the audio you deliver.β
π What does it take to grow as a Computer Engineering student, build projects, and explore global innovation?
This API is part of a bigger journey I share in Weekly Rewind β my real-time documentary podcast series, where I reflect weekly on coding breakthroughs, innovation insights, startup stories, and lessons from around the world.
A behind-the-scenes look at real-world experiences, global insights, and hands-on learning. Each episode includes:
- πΉ Inside My Coding & Engineering Projects
- πΉ Startup Ideas & Entrepreneurial Lessons
- πΉ Trends in Tech & AI
- πΉ Innovation from 15+ Countries
- πΉ Guest Conversations with Builders & Engineers
- πΉ Productivity, Learning & Growth Strategies
βTrue learning isnβt confined to tutorials β it comes from building real projects, exploring the world, and sharing the story.β
This is not just a podcast β itβs a journey of building, sharing, and scaling real-world impact.
MIT License β free for personal and commercial use.