Homeserver media upload from telegram chat, URL downloader.
1.3K
A self-hosted Telegram bot that watches your groups or chats for media URLs, downloads them to your server, and forwards them back as native Telegram media — videos play inline, photos show in gallery, audio streams directly. Built for home-server and NAS setups where you want a private, always-on download queue without any cloud dependency.
Send any public video or audio URL to a Telegram group or chat where the bot is a member. The bot will:
It handles multiple URLs at once using a background queue (3 concurrent downloads, up to 50 queued), so you can drop a batch of links and walk away.
Works with any site supported by yt-dlp, which covers several hundred platforms. Well-tested with:
.m3u8)Only public content is supported. Private or login-gated content will not work.
Talk to @BotFather on Telegram:
/newbot
Note down the Bot Token. Also get your API ID and API Hash from my.telegram.org.
Talk to @userinfobot to find your numeric Telegram user ID.
mkdir telegram-hs-fu && cd telegram-hs-fu
.envCopy the template below and fill in your values:
# Telegram credentials — from my.telegram.org and @BotFather
API_ID=your_api_id
API_HASH=your_api_hash
BOT_TOKEN=your_bot_token
# Where downloaded files are saved on the host
BASE_DIR=/your/media/folder/
BASE_FOLDER=/your/media/folder/
# Only respond in this chat/group name (optional — remove to allow all)
ALLOWED_CHAT="your group name"
# Your personal Telegram numeric user ID (owner/admin)
OWNER_ID=your_numeric_user_id
docker-compose.ymlservices:
HomeServerUploadTG:
image: prateekrajgautam/telegram-hs-fu:latest
restart: unless-stopped
env_file:
- ./.env
user: "1000:100"
volumes:
- /your/media/folder/:/your/media/folder/ # must match BASE_FOLDER in .env
- ./config:/src/config:rw # persistent state: session, settings, logs
working_dir: /src
stdin_open: true
tty: true
command: python3 main.py
# Create config directory with correct permissions
mkdir -p config
chmod 775 config
chown 1000:100 config
# Start the bot
docker compose up -d
# Watch startup logs
docker compose logs -f
You should see:
🤖 Telegram Download Bot Starting...
✅ Started download worker 1/3
✅ Started download worker 2/3
✅ Started download worker 3/3
🚀 Bot is ready!
Invite your bot to a Telegram group or just message it directly. Send any public video URL — the bot will start downloading immediately.
telegram-hs-fu/
├── .env ← your credentials (never commit this)
├── docker-compose.yml
└── config/ ← volume-mapped; survives container updates
├── bot.session Telegram session (auto-created)
├── group_configs.json per-group settings
├── uploaded_files.json upload tracking
└── bot_config.json global bot config
/configSend /config in any chat where the bot is active. You get a live inline-button panel:
⚙️ Group Config
📽 Quality: 720p
📦 Max size: 2000 MB
⏳ Delete countdown: 60s
[ 📽 Quality: 720p → tap to cycle ]
[ ⬇️ Auto DL: ✅ ON | 🖼 Albums: ✅ ON ]
[ 📤 As Media: ✅ ON | 🗑 Auto Del: ✅ ON ]
[ 🔄 Refresh | ❌ Close ]
Tap any button to toggle or cycle the setting instantly. Each group stores its own independent configuration.
quality=720p
maxsize=500
media=on
cleanup=on
cleanup_delay=60
| Command | Description |
|---|---|
/config | Open interactive settings panel |
/quality <best|1080p|720p|480p|360p|worst> | Set download quality |
/maxsize <MB> | Max file size to download (10–5000) |
/media <on|off> | Send as native media or as document |
/autodownload <on|off> | Auto-process URLs (default on) |
/albums <on|off> | Download full Instagram carousels |
/delay <seconds> | Countdown before showing MP3 option for YouTube (2–30) |
/cleanup <on|off> | Delete file from server after sending |
/cleanup_delay <seconds> | How long to wait before auto-deleting (10–600) |
/folder <path> | Change download folder for this group |
/queue | Show active and queued downloads |
/delete <path> | Manually delete a file from the server |
When a YouTube link is detected, the bot shows an inline prompt:
🎵 YouTube detected — choose format (6s to auto-select video):
[ 🎵 MP3 audio | 🎬 Video ]
Tap the button or wait — it auto-downloads as video after the timeout.
When Auto Del is on, after every successful send the bot posts:
🗑️ `My Video.mp4` will be deleted from server in 60s
[ ✅ Keep on server | 🗑️ Delete now ]
This keeps your server clean without losing the file in Telegram.
| Path in container | What to mount |
|---|---|
/src/config | ./config — persistent state directory |
/your/media/path | Same path as BASE_FOLDER in .env |
The config/ directory is the only thing you need to back up to preserve all settings and the bot session.
docker compose pull
docker compose down
docker compose up -d
Settings in config/ are preserved automatically.
The container runs as uid 1000, gid 100 (standard for most NAS systems like Synology and TrueNAS). If your system uses different ids, change user: "1000:100" in docker-compose.yml and adjust ownership of the config/ directory accordingly.
chown -R 1000:100 ./config
chmod -R 775 ./config
Bot doesn't respond to URLs
ALLOWED_CHAT in .env — remove it to allow all chats, or set it to the exact group nameSession lost after update
./config is correctly volume-mounted and owned by uid 1000Download fails
quality=best — some sources don't support resolution filteringBASE_FOLDER exists and is writable by uid 1000Files not deleting
cleanup=on is set for the group (/config)docker compose logs -fThis image bundles several open-source tools and libraries, each under their own respective licence:
The source code for this bot is available at: github.com/prateekrajgautam/telegram-hs-fu
Built and maintained by prateekrajgautam / mGeek.in
This project does not host, redistribute, or cache any third-party media content. All downloads are performed by the end user on their own hardware, for their own use, subject to the terms of service of each respective platform.
MIT — see source repository for full licence text.
Content type
Image
Digest
sha256:5f5ee6724…
Size
398.9 MB
Last updated
41 minutes ago
docker pull prateekrajgautam/telegram-hs-fu