Skip to content

PavlenkoEvgeniy/php-symfony-ytdownloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

680 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 Video & Audio Downloader for YouTube, Instagram, Telegram, TikTok, and More

Lightweight service to download video and audio from YouTube, Instagram, Telegram, TikTok, and more.

πŸ›  Tech Stack:

  • PHP 8 🐘
  • Symfony 7 🎼
  • EasyAdmin 4 πŸ› οΈ
  • Docker 🐳
  • PostgreSQL 🐘
  • Redis πŸš€
  • RabbitMQ πŸ‡
  • yt-dlp ⚑
  • p3sdev/php-ytdlp-wrapper πŸ“¦
  • botman/botman πŸ€–

πŸ“Έ Preview

Login page Index page Downloads page Admin dashboard Admin menu Admin menu

⚠️ Legal Disclaimer:

This program is strictly for lawful personal use. You must not use it to download, distribute, or otherwise process copyrighted material without explicit permission from the rights holder. Any use that violates YouTube's terms of service, applicable laws, or third‑party rights is prohibited. By using this program, you accept full responsibility for your actions and agree that the authors and contributors are not liable for any misuse or resulting violations.

πŸ“‹ Tested within:

  1. 🐧 Ubuntu 22.04
  2. 🐳 Docker 28.5.2
  3. πŸ“¦ Docker compose v2.38.1
  4. βš™οΈ GNU Make 4.3

πŸš€ Quick Start

⚑ Run the Project:

  1. Initialize new application:

    make init

    Remarks: During initialization, all env files (project and Docker) are generated automatically. If they are missing, run make env-setup.

  2. Restart application:

    make restart
  3. Stop application:

    make stop
  4. Setup database (if needed):

    make db-setup
  5. Start queue worker (if needed):

    make supervisor-start
  6. Create admin user by console command:

    make docker-php
    php bin/console app:user-add <username> [password]
  7. Run tests:

    make test
  8. Run tests with coverage:

    make test-coverage
  9. List of all available 'make' commands:

    make help
  10. Useful URLs:

  • Health check: GET http://host.tld/health
  • Admin dashboard: GET http://host.tld/admin

🧰 Docker env Xdebug defaults

Generated during make init (or make env-setup). Defaults below are from docker/.env.example:

  • Xdebug: XDEBUG_INSTALL=false, XDEBUG_MODE=off, XDEBUG_CLIENT_HOST=host.docker.internal, XDEBUG_CLIENT_PORT=9003

πŸ§ͺ Enable Xdebug (optional)

Set XDEBUG_INSTALL=true and XDEBUG_MODE=debug in your docker env file (created from docker/.env.example), then restart the stack:

make build
make restart

πŸ€– Telegram bot

  1. Initialize:
    • Enable the bot in .env.local: TELEGRAM_BOT_ENABLED=true
    • Set your bot token: TELEGRAM_BOT_TOKEN=change_me_please
    • Set the public host URL: TELEGRAM_HOST_URL=https://host.tld
    • Register the webhook:
      make telegram-bot-hook
    • To remove the webhook:
      make telegram-bot-unhook
  2. Commands:
    /start - start bot
    

πŸ” REST API v1 (JWT)

All API endpoints are prefixed with /api/v1 and require a Bearer token, except the login endpoint.

1) Login (get JWT token)

Request

POST /api/v1/auth/login
Content-Type: application/json

{
   "email": "admin@admin.local",
   "password": "admin123456"
}

Response

{
   "token": "<jwt>"
}

2) Authenticated requests

Add the JWT token to the Authorization header:

Authorization: Bearer <jwt>

3) Get current user

GET /api/v1/auth/me
Authorization: Bearer <jwt>

4) Logout (client-side)

JWT is stateless, so logout just tells the client to discard the token:

POST /api/v1/auth/logout
Authorization: Bearer <jwt>

5) Add new download

POST /api/v1/download/create
Authorization: Bearer <jwt>
Content-Type: application/json

{
   "url": "https://example.com",
   "quality": "best"  // best|moderate|poor|audio
}

6) List downloaded files

GET /api/v1/source?order=desc
Authorization: Bearer <jwt>

7) Download file by id

GET /api/v1/source/{id}/download
Authorization: Bearer <jwt>

8) Delete file by id

DELETE /api/v1/source/{id}
Authorization: Bearer <jwt>

πŸ” REST API v2 (JWT + Refresh token)

All API endpoints are prefixed with /api/v2. The login endpoint returns a JWT plus a refresh token. Use the JWT for authenticated requests. When the JWT expires, call refresh to get a new pair.

1) Login (get JWT + refresh token)

Request

POST /api/v2/auth/login
Content-Type: application/json

{
   "email": "admin@admin.local",
   "password": "admin123456"
}

Response

{
   "token": "<jwt>",
   "refresh_token": "<refresh_token>",
   "refresh_token_expires_at": "2026-01-31T12:00:00+00:00"
}

2) Authenticated requests

Add the JWT token to the Authorization header:

Authorization: Bearer <jwt>

3) Refresh tokens

Request

POST /api/v2/auth/refresh
Content-Type: application/json

{
   "refresh_token": "<refresh_token>"
}

Response

{
   "token": "<jwt>",
   "refresh_token": "<refresh_token>",
   "refresh_token_expires_at": "2026-01-31T12:00:00+00:00"
}

4) Get current user

GET /api/v2/auth/me
Authorization: Bearer <jwt>

5) Logout

POST /api/v2/auth/logout
Authorization: Bearer <jwt>

6) Add new download

POST /api/v2/download/create
Authorization: Bearer <jwt>
Content-Type: application/json

{
   "url": "https://example.com",
   "quality": "best"  // best|moderate|poor|audio
}

7) List downloaded files

GET /api/v2/source?order=desc
Authorization: Bearer <jwt>

8) Download file by id

GET /api/v2/source/{id}/download
Authorization: Bearer <jwt>

9) Delete file by id

DELETE /api/v2/source/{id}
Authorization: Bearer <jwt>

πŸ“ Todo Roadmap

  • Admin dashboard
  • Background video downloads (queues)
  • Download statistics counter
  • Download status notifications
  • Tests coverage
  • Health check endpoint
  • YouTube cache/cookies optimization (avoid anti-bot detection)
  • Telegram bot integration
  • REST API implementation
  • Playlist special characters fix
  • Refactor to services
  • Setup automation script
  • Own yt-dlp wrapper implementation

About

Service for downloading video/audio from youtube, instagram, telegram, tiktok, and more

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors