Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YT-DLP Live Stream Proxy

Auto-extract YouTube live stream URLs using yt-dlp and serve them via clean proxy paths.

Features

  • Add any YouTube channel handle (e.g. @ABCNews)
  • Automatically runs yt-dlp -g every 3 hours
  • Stores URLs in Supabase Database
  • Access streams via https://your-app.com/1.m3u8, /2.m3u8, etc.
  • Clean dark-mode web UI to manage channels

Supabase Setup

  1. Create a new project at supabase.com
  2. Go to Table EditorNew Table
  3. Create table channels:
    • id: int8, primary key, auto-increment
    • handle: text, not null
    • path: text, not null, unique
    • stream_url: text
    • status: text (default: 'pending')
    • error_msg: text
    • expires_at: timestamptz
    • updated_at: timestamptz
    • created_at: timestamptz, default: now()
  4. Go to Project SettingsAPI → copy URL and service_role key
  5. Paste them into your environment variables

Deploy on Render (Recommended)

  1. Push this repo to GitHub
  2. On Render, create a New Web Service → connect your repo
  3. Set Build Command:
    pip install yt-dlp && npm install
    
  4. Set Start Command:
    node server.js
    
  5. Add environment variables (SUPABASE_URL, SUPABASE_SERVICE_KEY)
  6. Deploy

Note: Render free web services spin down after 15 min inactivity. For reliable 3-hour cron jobs, use Render's Background Worker (paid) or upgrade to a paid web service. Alternatively, use an external ping service (like UptimeRobot) to hit /health every 5 minutes to keep it awake.

Deploy on Railway

  1. Push repo to GitHub
  2. Create new project → deploy from GitHub repo
  3. Add variables in Railway dashboard
  4. In Settings → add build command: pip install yt-dlp && npm install
  5. Railway keeps services running 24/7 on paid plans

Why not Vercel / Cloudflare Workers?

  • Vercel: Serverless functions have max timeout (~300s on Pro, 10s on Hobby). yt-dlp needs shell access and can take 30-60s. Not suitable.
  • Cloudflare Workers: No shell/binary access. Cannot run yt-dlp.
  • GitHub: Not a hosting platform for persistent servers. You could use GitHub Actions for cron, but not for serving web traffic.

API Endpoints

Method Endpoint Description
GET / Web UI
GET /api/channels List all channels
POST /api/channels Add channel (body: {handle})
DELETE /api/channels/:id Remove channel
POST /api/channels/:id/refresh Manual refresh
GET /:path.m3u8 Redirect to actual stream URL
GET /health Health check

How it works

  1. You add @ABCNews via the UI
  2. Server immediately runs: yt-dlp --js-runtimes node -g https://www.youtube.com/@ABCNews/live
  3. Output URL is saved to Supabase with path 1
  4. Every 3 hours, cron re-runs the command and updates the URL
  5. Visiting your-app.com/1.m3u8 302-redirects to the current live stream URL

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages