A Telegram bot that downloads media on Telegram using yt-dlp, with support for:
- YouTube
- TikTok
- Twitter / X
- Bluesky
Public bot: @SatoruBot
Need more help? Join the support group or the status channel
- Features
- Commands
- Requirements
- Quick Start (Local)
- Configuration Reference
- Docker Tutorial
- Usage Notes
- Telegram File Size Limit
- License
- Download video with
/download <url> - Download audio (MP3 extract) with
/audio <url> - Choose custom format with
/custom <url> - Optional logging to a Telegram chat/channel
- Domain allowlist for safer URL handling
- Docker support with
docker-compose
/startor/help— Show usage help/download <url>— Download video/audio <url>— Download and extract MP3/custom <url>— Show available formats and pick one/id— Return current chat ID (useful forlogsconfig)
In private chat, you can also just send a URL directly.
- Python 3.11+
ffmpeginstalled on your system- A Telegram bot token from @BotFather
- Docker
- Docker Compose plugin (
docker compose)
-
Clone the repo:
git clone https://github.com/ssebastianoo/yt-dlp-telegram cd yt-dlp-telegram -
Install dependencies:
pip install -r requirements.txt
-
Create
config.pyfrom the example:cp example.config.py config.py
-
Edit
config.py(at minimum settoken). -
Start the bot:
python3 main.py
If everything is correct, you should see output similar to:
ready as @your_bot_username
Create a config.py file in the project root. config.py example:
# The telegram bot token
token: str = "123456789:ABcdefGhiJKlmnO"
# The logs channel id, if none set to None
logs: int | None = None
# The maximum file size in bytes
max_filesize: int = 50000000
# The output folder for downloaded files, it gets cleared after each download
output_folder: str = "/tmp/satoru"
# The allowed domains for downloading videos
allowed_domains: list[str] = [
"youtube.com",
"www.youtube.com",
"youtu.be",
"m.youtube.com",
"youtube-nocookie.com",
"tiktok.com",
"www.tiktok.com",
"vm.tiktok.com",
"vt.tiktok.com",
"instagram.com",
"www.instagram.com",
"twitter.com",
"www.twitter.com",
"x.com",
"www.x.com",
"bsky.app",
"www.bsky.app",
]This project includes:
Dockerfile(Python + ffmpeg + app)docker-compose.yml(singlebotservice)
From project root:
cp example.config.py config.pyEdit config.py and set at least:
token- optionally
logs,max_filesize, etc.
docker compose up -d --buildThis will:
- build the image
- mount your local
config.pyinto container as read-only:./config.py:/app/config.py:ro
- start bot with restart policy
unless-stopped
docker compose logs -f botLook for:
ready as @your_bot_username
Stop:
docker compose downRestart:
docker compose restart botRebuild after code changes:
docker compose up -d --build-
Bot not starting
- Verify
config.pyexists in project root. - Verify
tokenis valid. - Check logs:
docker compose logs -f bot.
- Verify
-
No logs sent to
logschat- Ensure bot is in that chat/channel.
- Ensure
logsis correct numeric chat ID. - Ensure bot has permission to send messages.
-
Downloads fail due to size
- Reduce quality / choose smaller format via
/custom. - Lower
max_filesizeto fail fast and avoid long downloads. - Telegram limits still apply.
- Reduce quality / choose smaller format via
- In private chats, paste a link directly.
- In groups, use commands like
/download <url>. /customcan list many formats depending on source media.- Audio mode uses FFmpeg post-processing to extract MP3.
Bots are limited by Telegram upload constraints.
Reference: https://core.telegram.org/bots/faq#how-do-i-upload-a-large-file
Set max_filesize according to what you want the bot to attempt and what Telegram will accept in your use case.
This project is licensed under the repository’s LICENSE file.