A Node.js server that extracts the best possible HLS (m3u8) streaming URLs from YouTube Live
2.0K
A Node.js server that extracts the best possible HLS (m3u8) streaming URLs from YouTube Live streams using yt-dlp. Perfect for IPTV applications, media players, and streaming integrations.
# Using pre-built image (recommended)
docker pull su14iman/yt-hls-server:latest
docker run -p 8000:8000 -e TZ=Europe/Berlin su14iman/yt-hls-server:latest
# Or clone and use docker-compose
git clone https://github.com/su14iman/yt-hls-server.git
cd yt-hls-server
docker-compose up -d
# Or build and run manually
docker build -t yt-hls-server .
docker run -p 8000:8000 yt-hls-server
# Install dependencies
npm install
# Make sure yt-dlp is installed
pip3 install -U yt-dlp
# Start the server
node index.js
The server will start on http://localhost:8000
GET /hls_url?url=<youtube_url>&h=<target_height>&min=<min_height>
Parameters:
url (required): YouTube Live stream URLh (optional): Target height (e.g., 720, 1080)min (optional): Minimum acceptable heightExample:
curl "http://localhost:8000/hls_url?url=https://www.youtube.com/@AlekhbariahSY/live&h=720"
GET /playlist.m3u?url=<youtube_url>&name=<channel_name>&logo=<logo_url>&group=<group_name>&tvg_id=<id>&h=<height>&min=<min_height>
Parameters:
url (required): YouTube Live stream URLname (optional): Channel display name (default: "YouTube Live")logo (optional): Channel logo URLgroup (optional): IPTV group name (default: "YouTube")tvg_id (optional): TVG ID for EPGh (optional): Target heightmin (optional): Minimum heightExample:
curl "http://localhost:8000/playlist.m3u?url=https://www.youtube.com/@AlekhbariahSY/live&name=Al%20Ekhbariah&h=720"
GET /redirect.m3u8?url=<youtube_url>&h=<height>&min=<min_height>
Returns a 302 redirect directly to the HLS stream URL.
Example:
curl -L "http://localhost:8000/redirect.m3u8?url=https://www.youtube.com/@AlekhbariahSY/live&h=1080"
GET /
Returns "OK" for health monitoring.
The server uses intelligent quality selection:
h): Prefers streams at or below the target resolutionmin): Filters out streams below this resolutionh=720: Get best stream ≤ 720pmin=480: Only streams ≥ 480ph=1080&min=720: Prefer 1080p, but accept 720p+ if 1080p unavailable#EXTM3U
#EXTINF:-1 tvg-id="news1" tvg-logo="https://example.com/logo.png" group-title="News",News Channel
http://your-server:8000/redirect.m3u8?url=https://www.youtube.com/@newschannel/live&h=720
# VLC
vlc "http://localhost:8000/redirect.m3u8?url=https://www.youtube.com/@channel/live"
# FFmpeg
ffmpeg -i "http://localhost:8000/hls_url?url=https://www.youtube.com/@channel/live" output.mp4
const response = await fetch('/hls_url?url=https://www.youtube.com/@channel/live&h=720');
const hlsUrl = await response.text();
// Use with HLS.js or similar player
PORT: Server port (default: 8000)TZ: Timezone for Docker container (default: Europe/Berlin)The included docker-compose.yml provides:
Content type
Image
Digest
sha256:ea3989d07…
Size
537.6 MB
Last updated
about 1 year ago
docker pull su14iman/yt-hls-server