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.
expo-file-system (mobile)Content-Disposition: attachment triggers Save-As on all platformsContent-Length headers forwarded from CDN for native mobile progress barsgit clone https://github.com/fazi-gondal/FastAPI.git
cd FastAPI
pip install -r requirements.txt
python main.py
Server starts at http://localhost:8000
http://localhost:8000See 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
pip install -r requirements.txtuvicorn main:app --host 0.0.0.0 --port $PORTProduction 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
hd=1 for HD no-watermark, falls back to play (SD)tiktok.com, vm.tiktok.com, vt.tiktok.comcookies.txt in project rootSee 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
cookies.txt gitignoredhttpx is up to date: pip install --upgrade httpxSee 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.
/api/stream: replaced invalid await client.stream() with correct await client.send(request, stream=True) (httpx API fix)direct_url query paramforce_backend_stream routing with XHR-based downloadViaBackendStream() and real progress bar/api/tiktok/info endpoint: returns full TikWM data object (hdplay, play, wmplay, cover, author, music_info) for React Native appsget_tiktok_info() function in downloader.pyContent-Length headers for native progress barsContent-Disposition: attachment forced on all proxied streamsPRs welcome! Please open an issue first for major changes.
MIT License — see LICENSE.
Fazi Gondal