A powerful FastAPI-based video downloader supporting Instagram, TikTok, YouTube, and 1000+ platforms β with zero-disk streaming, server-side proxy, and real-time progress tracking.
- π₯ Multi-Platform Support: Download from Instagram, TikTok, YouTube, Facebook, Twitter/X, and 1000+ sites via yt-dlp
- π« TikTok Without Watermark: HD no-watermark downloads powered by the TikWM API
- π¬ Instagram HD Quality: Download Instagram Reels/Posts in 720p+
- π Real-Time Progress: Live download progress via XHR (web) and
expo-file-system(mobile) - π± Mobile Ready: Zero-change React Native/Expo integration β works out of the box
- π CORS Enabled: Works with web browsers, mobile apps, and Expo Go
- π Server-Side Stream Proxy: Bypasses TikTok CDN blocking on mobile & mobile web
- πͺ Cookie Support: Bypass YouTube bot detection
- ποΈ Auto Cleanup: Automatic temp file cleanup after download
- π¨ Modern UI: Glassmorphism dark-mode web interface with live progress bar
- βοΈ Production Ready: Deployed on Render with zero-disk-storage streaming
- π₯ Force Download:
Content-Disposition: attachmenttriggers Save-As on all platforms - π Native Progress:
Content-Lengthheaders forwarded from CDN for native mobile progress bars - β‘ Optimized: Single TikWM API call per request (no double fetches)
git clone https://github.com/fazi-gondal/FastAPI.git
cd FastAPI
pip install -r requirements.txt
python main.pyServer starts at http://localhost:8000
- Python 3.11+
- FastAPI, uvicorn, httpx, yt-dlp, aiofiles
- Open
http://localhost:8000 - Paste a TikTok, Instagram, YouTube, or any supported video URL
- Hit Get Video β metadata loads automatically
- Download starts with real-time progress bar
See API.md for full API documentation.
// Fetch metadata
const res = await fetch('/api/metadata', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ url: 'https://www.tiktok.com/@user/video/123' })
});
const { data } = await res.json();
// { title, thumbnail, duration, uploader, platform }See REACT_NATIVE_INTEGRATION.md for the complete guide.
npx expo install expo-file-system expo-media-library axios- Push to GitHub
- Connect repo on Render
- Set:
- Build:
pip install -r requirements.txt - Start:
uvicorn main:app --host 0.0.0.0 --port $PORT
- Build:
Production URL: https://fastapi-u8bm.onrender.com
See DEPLOYMENT.md for Koyeb and other platforms.
| Endpoint | Method | Description |
|---|---|---|
/api/metadata |
POST | Get video title, thumbnail, duration, uploader |
/api/get-direct-url |
POST | Resolve download URL (proxy or CDN) |
/api/stream |
GET | Server-side proxy stream β for TikTok & CDN-blocked platforms |
/api/tiktok/info |
GET | Full TikWM data: hdplay, play, wmplay, cover, author, music_info |
/api/proxy-stream |
POST | Lightweight CDN proxy (POST variant) |
/api/server-stream |
POST | yt-dlp server-download + stream (DASH/merged) |
/api/download/start |
POST | Start background download, returns ID |
/api/download/progress/{id} |
GET | SSE progress stream |
/api/download/file/{id} |
GET | Serve completed download file |
/api/thumbnail |
GET | CORS proxy for CDN thumbnails |
Web/Mobile β POST /api/get-direct-url
Backend β TikWM API (hd=1) β single call
Backend β { direct_url: "/api/stream?url=...&direct_url=<cdn>" }
Web/Mobile β GET /api/stream?url=...&direct_url=<cdn> (fast path, no 2nd API call)
Backend β Proxy TikWM CDN bytes β Client (with Content-Length)
Web/Mobile β POST /api/get-direct-url β yt-dlp extracts URL
Backend β { direct_url: "/api/stream?url=..." }
Client β GET /api/stream β yt-dlp CDN β Client
Web/Mobile β POST /api/get-direct-url β yt-dlp extracts CDN URL
Backend β { direct_url: "https://cdn.example.com/...", force_backend_stream: true }
Client β GET /api/stream β Proxied stream β Client
- β YouTube (with cookie support)
- β Instagram (Posts, Reels, IGTV in HD)
- β TikTok (watermark-free, HD via TikWM API)
- β Facebook
- β Twitter/X
- β Vimeo
- β Reddit
- β 1000+ more via yt-dlp
- TikWM API:
hd=1for HD no-watermark, falls back toplay(SD) - Zero double-calls: pre-resolved CDN URL embedded in the stream proxy URL
- Mobile safe: server-side proxy bypasses TikTok CDN CORS blocks on all clients
- URL formats:
tiktok.com,vm.tiktok.com,vt.tiktok.com
- HD quality (720p+), supports Reels, Posts, IGTV
- CORS thumbnail proxy included
- Server-side merge for DASH streams
- Best video + audio quality merged (MP4)
- Cookie support for bot detection bypass
- Install Get cookies.txt
- Export cookies from YouTube.com
- Save as
cookies.txtin project root - Restart the server
See YOUTUBE_COOKIES.md for details.
FastAPI/
βββ main.py # FastAPI app β all endpoints
βββ downloader.py # yt-dlp + TikWM download logic
βββ requirements.txt
βββ runtime.txt
βββ Procfile
βββ static/
β βββ index.html # Glassmorphism dark UI
β βββ style.css
β βββ script.js # XHR-based download with live progress
βββ temp_downloads/ # Auto-cleaned temp files
- CORS open for all origins (restrict in production as needed)
cookies.txtgitignored- Auto temp file cleanup (on startup + after serve)
- No video data stored beyond TTL
- Check server logs β likely a CDN token expiry (re-fetch URL)
- Ensure
httpxis up to date:pip install --upgrade httpx
See YOUTUBE_COOKIES.md.
TikTok CDN may not return Content-Length (chunked encoding). Progress shows received MB instead of percentage. This is normal.
Use /api/server-stream β it runs yt-dlp to merge DASH streams with audio.
- β
Fixed 500 error on
/api/stream: replaced invalidawait client.stream()with correctawait client.send(request, stream=True)(httpx API fix) - β
Eliminated double TikWM API call: pre-resolved CDN URL embedded in stream URL via
direct_urlquery param - β
Web frontend TikTok fix: added
force_backend_streamrouting with XHR-baseddownloadViaBackendStream()and real progress bar - β
New
/api/tiktok/infoendpoint: returns full TikWM data object (hdplay,play,wmplay,cover,author,music_info) for React Native apps - β
New
get_tiktok_info()function indownloader.py - β No mobile app changes required β backend changes are fully backward-compatible
- β TikWM API integration for HD no-watermark TikTok downloads
- β Mobile stability fixes β resolved React Native video crashes
- β
Content-Lengthheaders for native progress bars - β Zero-disk streaming for TikTok and Instagram
- β
Content-Disposition: attachmentforced on all proxied streams
- β Real-time progress tracking with SSE
- β Three-step download process
- β YouTube cookie support
- β Automatic file cleanup
- β Modern lifespan event handlers
- β Initial release β multi-platform support, FastAPI backend, glassmorphism UI
PRs welcome! Please open an issue first for major changes.
MIT License β see LICENSE.
Fazi Gondal
- GitHub: @fazi-gondal
- Email: nextinpk@gmail.com
- yt-dlp β The amazing video downloader
- TikWM β TikTok no-watermark API
- FastAPI β Modern Python web framework
- Expo β React Native development platform