Video Downloader Backend

This directory contains the server-side code for the Video Downloader application.

Structure

  • index.ts - Main entry point and API routes
  • services/ - Service modules for different video platforms
    • youtube.ts - YouTube-specific download functionality
    • generic.ts - Generic video download functionality for other platforms

API Endpoints

GET /

Serves the main application HTML.

GET /frontend/* and /shared/*

Serves static files from the frontend and shared directories.

POST /api/info

Get information about a video before downloading.

Request Body:

{ "url": "https://www.youtube.com/watch?v=..." }

Response:

{ "title": "Video Title", "thumbnail": "https://...", "duration": 123, "formats": [ { "quality": "720p", "format_id": "22", "ext": "mp4", "resolution": "1280x720" }, ... ], "url": "https://www.youtube.com/watch?v=..." }

POST /api/download

Download a video.

Request Body:

{ "url": "https://www.youtube.com/watch?v=...", "quality": "720p" // Optional }

Response:

{ "success": true, "downloadUrl": "https://...", "title": "Video Title" }

Or in case of error:

{ "success": false, "error": "Error message" }

GET /api/health

Health check endpoint.

Response:

{ "status": "ok" }