Skip to content

prempscode/yt-downloader-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

YT Downloader — Web App

A YouTube downloader that works on any device (phone, tablet, desktop).
Frontend: GitHub Pages | Backend: Railway (free)


How it works

Your Phone/Browser
      │
      ▼
  GitHub Pages         ← just HTML, no server needed
  (frontend/index.html)
      │  POST /download
      ▼
  Railway Server       ← Flask + yt-dlp + ffmpeg (free tier)
  (backend/server.py)
      │
      ▼
  File streamed back → saved to your device

Step 1 — Deploy the Backend to Railway (free)

  1. Go to railway.app → sign up with GitHub (free)
  2. Click "New Project""Deploy from GitHub repo"
  3. Create a new GitHub repo, upload the backend/ folder contents to it
  4. Railway auto-detects Python and deploys it
  5. Go to Settings → Networking → Generate Domain
    You'll get a URL like: https://yt-downloader-production.up.railway.app

Free tier: 500 hours/month — plenty for personal use


Step 2 — Set your API URL in the frontend

Open frontend/index.html and find line ~10:

const API_URL = "";

Change it to your Railway URL:

const API_URL = "https://yt-downloader-production.up.railway.app";

Step 3 — Deploy Frontend to GitHub Pages

  1. Create a GitHub repo (e.g. yt-downloader)
  2. Upload frontend/index.html to the repo
  3. Go to repo Settings → Pages → Source → main branch → / (root)
  4. Your site is live at: https://yourusername.github.io/yt-downloader

That's it! Works on any device with a browser.


Alternative: Render (also free)

  1. Go to render.com → New → Web Service
  2. Connect your backend repo
  3. Set:
    • Build command: pip install -r requirements.txt
    • Start command: gunicorn server:app --bind 0.0.0.0:$PORT --timeout 600
  4. Get your URL from the dashboard

Note: Render free tier spins down after 15 min of inactivity (first request takes ~30s to wake up)


File structure

yt-web/
├── frontend/
│   └── index.html        ← deploy to GitHub Pages
└── backend/
    ├── server.py          ← Flask + yt-dlp API
    ├── requirements.txt   ← auto-installs everything incl. ffmpeg
    ├── Procfile           ← for Railway/Render
    └── railway.json       ← Railway config

FAQ

Q: Is it free?
Railway gives 500 free hours/month. GitHub Pages is always free.

Q: Does it work on iPhone/Android?
Yes — the file downloads directly to your device's Downloads folder.

Q: Does it store my videos?
No. Files are processed in a temp folder and deleted after being sent.

Q: Why does the first download take long?
Railway/Render may spin up the server (cold start ~10-30s). After that it's fast.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors