Files
yt-dlp-proxy/README.md
T
Mikhail Yevchenko ff6e727ae7 Initial implementation of yt-dlp HLS proxy server
- Flask app with HLS proxy routes (/hls, /player, /)
- yt-dlp integration with 365-day in-memory cache
- URL validation with allowed domains (youtube, pornhub, etc)
- HTML5 HLS player with hls.js
- Unit tests: URL validation, cache, error handling
- Integration tests: ffmpeg-generated test video, full proxy chain
- Environment-based configuration (PORT, CACHE_TTL, LOG_LEVEL)
- MIT license
2026-04-01 11:10:05 +00:00

1.2 KiB

yt-dlp HLS Proxy

A simple Flask proxy server that uses yt-dlp to fetch HLS streams and serves them through a web player.

Features

  • HLS stream proxying via yt-dlp
  • In-memory caching (365 days TTL by default)
  • URL validation with allowed domains
  • HTML5 video player with hls.js
  • Configurable via environment variables

Quick Start

pip install -r requirements.txt
cp .env.example .env
python app.py

Visit http://localhost:5000 and enter a video URL.

Configuration

Variable Default Description
PORT 5000 Server port
LOG_LEVEL INFO Logging level
CACHE_TTL 31536000 Cache TTL in seconds (365 days)
SOCKET_TIMEOUT 30 Socket timeout for requests
VALIDATION_ENABLED true Enable URL validation
ALLOWED_DOMAINS youtube.com,youtu.be,pornhub.com,xvideos.com Allowed video domains

Routes

  • / - Home page with video URL input
  • /player?url=VIDEO_URL - Video player page
  • /hls/<query>/index.m3u8 - HLS playlist proxy
  • /hls/<query>/<segment>.ts - HLS segment proxy

Running with Gunicorn

gunicorn -w 4 -b 0.0.0.0:5000 app:app

Testing

pytest tests/test_proxy.py -v

License

MIT