A lightweight Go + Gin REST API wrapping yt-dlp, gallery-dl, and ffmpeg for extracting metadata, searching tracks/videos, and auto-downloading videos, audio, photos, and carousels across major platforms. Designed for private/internal Docker deployments without authentication.
API Reference: See API.md for endpoints and examples, or open
/swagger/index.htmlwhen running.
| Platform | Features | Endpoints |
|---|---|---|
| YouTube | Video, Audio, Search | /api/v1/youtube/{search,video,audio} |
| TikTok | Video, Audio, Carousel | /api/v1/tiktok/download |
| Reels, Videos, Photos, Carousels, Stories | /api/v1/instagram/download |
|
| Threads | Video, Image, Carousel | /api/v1/threads/download |
| X (Twitter) | Video, GIF, Images, Multi-item | /api/v1/twitter/download |
| SoundCloud | Search, Audio-only | /api/v1/soundcloud/{search,download} |
| Reels, Watch, Public Video/Image | /api/v1/facebook/download |
|
| Image, Video, GIF, Carousel | /api/v1/pinterest/download |
|
| Universal | Auto-detect + 1,000+ yt-dlp / gallery-dl sites |
/api/v1/{info,download,search} |
cp .env.example .env
docker compose up -d --builddocker pull ghcr.io/justpiple/ytdlp-api:latest
docker run -d --name ytdlp-api \
-p 8080:8080 \
-v ./cookies:/app/cookies:ro \
ghcr.io/justpiple/ytdlp-api:latestRequires Go 1.26+, yt-dlp, gallery-dl (plus PySocks for SOCKS proxy support, see requirements.txt), ffmpeg, and deno.
make swag # Regenerate Swagger specs in docs/
make test-race # Run tests with -race and -shuffle=on
make run # Start server on :8080Configure via .env or environment variables (see .env.example). All variables include ${VAR:-default} bindings in docker-compose.yml so PaaS tools like Coolify auto-populate defaults for customization:
| Variable | Default | Description |
|---|---|---|
PORT |
8080 |
HTTP listening port |
GIN_MODE |
release |
Gin mode (debug, release, test) |
BASE_URL |
"" |
Base URL for generated download_url links (auto-detected if empty) |
LOG_LEVEL |
info |
JSON log level (debug, info, warn, error) |
PROXY_URL |
"" |
Default upstream proxy (http://... or socks5://...) |
YTDLP_PATH |
yt-dlp |
Path or command name for yt-dlp |
GALLERYDL_PATH |
gallery-dl |
Path or command name for gallery-dl |
FFMPEG_PATH |
ffmpeg |
Path or command name for ffmpeg |
COOKIES_FILE |
"" |
Fallback global Netscape cookies.txt path |
COOKIES_DIR |
./cookies |
Directory for per-platform cookies (e.g. instagram.txt, youtube.txt) |
TEMP_DIR |
/tmp/ytdlp-api |
Temporary storage path for downloaded files |
FILE_TTL |
15m |
TTL before hosted temporary files expire |
CLEANUP_INTERVAL |
5m |
Cleanup interval for expired temporary files |
MAX_CONCURRENT_DOWNLOADS |
4 |
Max concurrent yt-dlp/ffmpeg processes |
DOWNLOAD_TIMEOUT |
5m |
Per-download timeout |
INFO_TIMEOUT |
45s |
Metadata & search timeout |
MAX_FILESIZE |
100M |
Default --max-filesize limit |
MAX_PLAYLIST_ITEMS |
10 |
Max items downloaded for carousel/playlist URLs |
CONCURRENT_FRAGMENTS |
4 |
Parallel fragment downloads (--concurrent-fragments) for HLS/DASH streams |
FFMPEG_PRESET |
veryfast |
libx264 preset used when transcoding non-H.264 video (ultrafast..veryslow) |
- Per-platform cookies: Place Netscape-format cookie files in
./cookies/(e.g.instagram.txt,youtube.txt,twitter.txt,threads.txt,facebook.txt,tiktok.txt,pinterest.txt). - Global cookies: Set
COOKIES_FILEas a fallback. - Proxy: Set
PROXY_URLglobally. It applies to all downloads and info requests.
.github/workflows/ci.ymlrunsgo vet,go test -race -shuffle=on, builds the Docker image, verifies/healthz&/swagger/index.htmlvia a container smoke test, and pushes toghcr.io/justpiple/ytdlp-api..github/dependabot.ymltracksrequirements.txtdaily and opens PRs for newyt-dlpreleases.