A Telegram bot that downloads videos and audio from YouTube, YouTube Music, and Instagram — with support for playlists, multiple audio formats, and a self-hosted Bot API server for files up to 2 GB.
- 📹 YouTube — Download videos or extract audio (MP3, FLAC, WAV)
- 🎵 YouTube Music — Direct audio download with format selection
- 📸 Instagram — Posts, Reels, Stories, and Carousels with metadata
- 📦 Playlist support — Batch download entire YouTube playlists
- 🏠 Self-Hosted API — Bypass Telegram's 50 MB limit (up to 2 GB)
- 🏓 Admin /ping — Live system stats, API latency, and active task monitoring
- ☁️ Gofile fallback — Auto-uploads oversized files to Gofile.io
- ⚡ Concurrent processing — Handles multiple users simultaneously
This is the simplest setup. Files larger than 50 MB will be uploaded to Gofile.
git clone https://github.com/sayann70/YT-Reels-BotTG-Public YT-Reels-BotTG && cd YT-Reels-BotTG
pip install -r requirements.txtcp .env.example .envEdit .env and set your bot token:
BOT_TOKEN = "YOUR_BOT_TOKEN_HERE"python3 bot.pyThat's it! Send a YouTube or Instagram link to your bot.
To send files larger than 50 MB directly through Telegram, you need to run your own Telegram Bot API Server.
- Docker installed on your machine
- API ID & Hash from my.telegram.org → "API development tools"
A docker-compose.yml is included in this repo. Add your API credentials to .env:
TELEGRAM_API_ID = 12345678
TELEGRAM_API_HASH = your_api_hash_here
USE_LOCAL_API = trueStart the server:
sudo docker compose up -dRequired once before switching to the local server:
curl https://api.telegram.org/bot<YOUR_BOT_TOKEN>/logOutWait 10 minutes, then start the bot:
python3 bot.pySet USE_LOCAL_API = false in .env, call the logout endpoint on your local server, wait 10 minutes, and restart.
All settings are in .env (see .env.example for reference):
| Variable | Default | Description |
|---|---|---|
BOT_TOKEN |
required | Telegram Bot Token from @BotFather |
ADMIN_ID |
0 |
Your Telegram user ID (send /ping to find out) |
USE_LOCAL_API |
false |
Enable self-hosted Bot API server |
LOCAL_API_SERVER |
http://localhost:8081 |
Address of local API server |
TELEGRAM_API_ID |
— | API ID from my.telegram.org (for Docker) |
TELEGRAM_API_HASH |
— | API Hash from my.telegram.org (for Docker) |
MAX_FILE_SIZE_MB |
Auto | 49 (official) or 1999 (local) — auto-detected |
MAX_PLAYLIST_SIZE |
50 |
Max videos per playlist |
INSTAGRAM_USERNAME |
— | Instagram login (optional, for private content) |
INSTAGRAM_PASSWORD |
— | Instagram password |
| Command | Access | Description |
|---|---|---|
/start |
Everyone | Welcome message and usage info |
/help |
Everyone | Supported platforms and settings |
/ping |
Admin only | System stats, API latency, active tasks |
├── bot.py # Main bot script
├── .env.example # Configuration template (DO NOT MAKE THIS PUBLIC AFTER CONFIGURATION!!!)
├── docker-compose.yml # Local Bot API server (Docker)
├── requirements.txt # Python dependencies
└── README.md # This file
- Python 3.10+
- python-telegram-bot (v20+)
- yt-dlp — YouTube & Instagram downloads
- instaloader — Instagram metadata & downloads
- httpx — Async HTTP client
- Pillow — Thumbnail processing
- psutil — System monitoring for /ping
- Docker — Self-hosted Bot API server (optional)
- Ensure
ffmpegis installed and available in your system PATH. - This bot is for educational and personal use only.
- Follow the terms of service for YouTube, Instagram, and Telegram.
- Instagram private posts require login credentials.
MIT License © 2025 Sayan Sarkar | sayann70