| .assets | ||
| .github | ||
| app_api | ||
| app_bot | ||
| app_worker | ||
| envs | ||
| yt_shared | ||
| .dockerignore | ||
| .editorconfig | ||
| .env | ||
| .gitignore | ||
| base.Dockerfile | ||
| docker-compose.yml | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
| RELEASES.md | ||
| start.py | ||
| uv.lock | ||
yt-dlp-bot - Video Download Telegram Bot 🇺🇦
Simple and reliable self-hosted Video Download Telegram Bot.
Version: 1.7.1. Release details.
Support the development
- Buy me a coffee
- PayPal

- Bitcoin wallet
14kMRS8SvfD2ydMSMEyAmefHV3Yynf9kAd
😂 Features
- Download audio and free videos with Creative Commons (CC) License from yt-dlp sites to your storage.
- Upload downloaded media to Telegram.
- Interact with the bot in private or group chats.
- Trigger video downloads via link to the API.
- Track download tasks using the API.
Disclaimer
- Intended to use only with videos that are under Creative Commons (CC) License
⚙ Quick Setup
- Create Telegram bot using BotFather and get your
token - Get your Telegram API Keys (
api_idandapi_hash) - Find your Telegram User ID
- Copy
app_bot/config-example.ymltoapp_bot/config.yml - Write
token,api_id,api_hashtoapp_bot/config.ymlby changing respective placeholders - Write your Telegram user or group ID to the
allowed_users->idby replacing dummy value and changeforward_group_idvalue if you want to forward the video to some group/channel when upload is enabled. Bot should be added to the group/channel to be able to send messages. - Change download media type for the user/group:
AUDIO,VIDEOorAUDIO_VIDEOinapp_bot/config.yml's variabledownload_media_type. DefaultVIDEO - If you want your downloaded audio/video to be uploaded back to the Telegram, set
upload_video_fileconfig variable for your user/group in theapp_bot/config.ymltoTrue - Media
STORAGE_PATHenvironment variable is located in theenvs/worker.envfile. By default, it's/filestoragepath inside the container. What you want is to map the real path to this inside thedocker-compose.ymlfile forworkerservice, e.g. if you're on Windows, next strings mean container path/filestorageis mapped to realD:/Videosso your videos will be saved to yourVideosfolder.worker: volumes: - "D:/Videos:/filestorage" - Change application's
LOG_LEVELinenvs/common.envtoDEBUG,INFO,WARNING,ERROR,CRITICALif needed
🏃 Run
# Build base image
docker compose build base-image
# Build and run all services in detached mode
docker compose up --build -d -t 0 && docker compose logs --tail 100 -f
# Stop all services
docker compose stop -t 0
Your Telegram Bot should send you a startup message:
✨ <YOUR_BOT_NAME> started, paste a video URL(s) to start download and that's it. After
pasting video URL(s) bot will send you appropriate message whether they were downloaded
or something went wrong.
💻 Advanced setup
- If you want to change
yt-dlpdownload options, go to theapp_worker/ytdl_optsdirectory, copy content fromdefault.pytouser.pyand modify as you wish by checking available options. - Default max simultaneous video downloads by worker service is 2. Change
the
MAX_SIMULTANEOUS_DOWNLOADSvariable inenvs/worker.envto desired value but keep in mind that default mounted volume size is 7168m (7GB) indocker-compose.ymlso it may be not enough if you download a lot of large videos at once. yt-dlpwill try to download video thumbnail if it exists. In other case Worker service (particularly the FFmpeg process) will make a JPEG thumbnail from the video. It's needed when you choose to upload the video to the Telegram chat. By default, it will try to make it on the 10th second of the video, but if the video is shorter, it will make it onvideo length / 2time point because the FFmpeg process will error out. Change theTHUMBNAIL_FRAME_SECONDvariable if needed in theenvs/worker.envfile.- Max upload file size for non-premium Telegram user is 2GB (2147483648 bytes) which is
reflected in the example config
app_bot/config-example.yml. If the configured user is the premium user, you're allowed to upload files up to 4GB (4294967296 bytes) and can change the default value stored in theupload_video_max_file_sizeconfig variable. - If the website you want to download from requires authentication you can use your cookies by putting them into
the
app_worker/cookies/cookies.txtfile in the Netscape format.
🛑 Failed download
If your URL can't be downloaded for some reason, you will see a message with error details
Access
- API: default port is
1984and no auth. Port can be changed indocker-compose.yml - RabbitMQ: default credentials are located in
envs/common.env - PostgreSQL: default credentials are located in
envs/common.env.
API
By default, API service will run on your localhost and 1984 port. API endpoint
documentations lives at http://127.0.0.1:1984/docs.
| Endpoint | Method | Description |
|---|---|---|
/status |
GET |
Get API healthcheck status, usually response is {"status": "OK"} |
/v1/yt-dlp |
GET |
Get latest and currently installed yt-dlp version |
/v1/tasks/?include_meta=False&status=DONE |
GET |
Get all tasks with filtering options like to include large file metadata and by task status: PENDING, PROCESSING, FAILED and DONE. |
/v1/tasks/f828714a-5c50-45de-87c0-3b51b7e04039?include_meta=True |
GET |
Get info about task by ID |
/v1/tasks/latest?include_meta=True |
GET |
Get info about latest task |
/v1/tasks/f828714a-5c50-45de-87c0-3b51b7e04039 |
DELETE |
Delete task by ID |
/v1/tasks |
POST |
Create a download task by sending json payload {"url": "<URL>"} |
/v1/tasks/stats |
GET |
Get overall tasks stats |
API examples
-
GET http://localhost:1984/v1/tasks/?include_meta=False&status=DONE&limit=2&offset=0Response
[ { "id": "7ab91ef7-461c-4ef6-a35b-d3704fe28e6c", "url": "https://www.youtube.com/watch?v=PavYAOpVpJI", "status": "DONE", "source": "BOT", "added_at": "2022-02-14T02:29:55.981622", "created": "2022-02-14T02:29:57.211622", "updated": "2022-02-14T02:29:59.595551", "message_id": 621, "file": { "id": "4b1c63ed-3e32-43e6-a0b7-c7fc8713b268", "created": "2022-02-14T02:29:59.597839", "updated": "2022-02-14T02:29:59.597845", "name": "[Drone Freestyle] Mountain Landscape With Snow | Free Stock Footage | Creative Common Video", "ext": "mp4" } } ] -
POST http://localhost:1984/v1/tasksRequest
{ "url": "https://www.youtube.com/watch?v=PavYAOpVpJI", "download_media_type": "AUDIO_VIDEO", "save_to_storage": false, "custom_filename": "cool.mp4", "automatic_extension": false }Response
{ "id": "5ac05808-b29c-40d6-b250-07e3e769d8a6", "url": "https://www.youtube.com/watch?v=PavYAOpVpJI", "source": "API", "added_at": "2022-02-14T00:35:25.419962+00:00" } -
GET http://localhost:1984/v1/tasks/statsResponse
{ "total": 39, "unique_urls": 5, "pending": 0, "processing": 0, "failed": 26, "done": 13 }

