A Telegram bot that transcribes video/audio and generates structured Markdown summaries via AI.
- YouTube links — downloads audio, extracts subtitles (ru/en), transcribes via Whisper
- File uploads — accepts video/audio files from Telegram (mp4, webm, mkv, mov, avi, mp3, m4a, wav, ogg, flac)
- Transcription — faster-whisper large-v3 on GPU (CUDA) with timestamps
- Structured summary — generated via Qwen AI (chat.qwen.ai) with emoji headers, Obsidian callouts, tables, checklists, code blocks
- Smart caching — downloaded audio, transcriptions, and subtitles are cached by video ID; repeated requests skip download and transcription
- Whitelist — only authorized users can access the bot
- Admin panel — statistics, user management, logs, cache clearing, stats reset
- Proxy support — MTProxy for Telegram, SOCKS5 for yt-dlp with health check and automatic fallback
- Python 3.10+
- CUDA 12.x + cuDNN (required for GPU transcription)
- FFmpeg (for audio conversion)
git clone https://github.com/Nighty3098/VideoToSummaryAiBot && cd VideoToSummaryAiBot
bash install.shThe script creates a venv, installs pip dependencies, and downloads Playwright Chromium.
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
playwright install chromiumcp .env.example .env
# fill in BOT_TOKEN, API_ID, API_HASH| Variable | Required | Description |
|---|---|---|
BOT_TOKEN |
yes | Bot token from @BotFather |
API_ID |
yes | API ID from my.telegram.org |
API_HASH |
yes | API Hash from my.telegram.org |
ADMIN_ID |
yes | Telegram ID of the admin |
USE_PROXY |
no | MTProxy for Telegram (1/0) |
PROXY_URL |
no | tg://proxy?server=... |
USE_SOCKS5 |
no | SOCKS5 for yt-dlp (1/0) |
SOCKS5_PROXY |
no | socks5://user:pass@host:port |
WHISPER_CACHE_DIR |
no | Whisper model cache directory |
- Send the bot a YouTube link or a video/audio file
- The bot downloads media → transcribes via Whisper → generates a structured summary via Qwen AI
- Receive a
.mdfile with the formatted summary
Repeated requests for the same YouTube video use cached audio and transcription — only the AI summary is regenerated.
Command /admin_p:
| Button | Action |
|---|---|
| 📊 Statistics | Request statistics |
| 👥 Users | User list, removal |
| ➕ Add User | Add user (by ID or forwarded message) |
| 📋 Logs | Last 200 lines of today's log |
| 🧹 Clear Cache | Clears temp/ and logs/ |
| 🔄 Reset Stats | Resets all request statistics |
cache/
yt_{video_id}/
meta.json — {title, transcription: true, audio: true}
audio.mp3 — downloaded audio
subtitles.txt — subtitles (if available)
transcription.txt — Whisper transcription
The cache is checked at each stage of the pipeline:
- Transcription cached → skip download, transcription, go straight to AI summary
- Audio cached → skip download, run Whisper + AI, cache transcription
- Nothing cached → full pipeline, all results cached
# find libcublas.so.12
sudo find / -name libcublas.so.12 -type f 2>/dev/null
# add to LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/path/to/cuda_v12:$LD_LIBRARY_PATHThe bot auto-detects the library in common paths (Ollama, LM Studio, CUDA 12.x).
source venv/bin/activate && playwright install chromium- Wait 15-30 minutes
- Configure SOCKS5 proxy in
.env - Subtitle errors are non-fatal — the pipeline continues
- Check
BOT_TOKEN,API_ID,API_HASHin.env - Verify the user is whitelisted (
/admin_p→ Add User) - Check logs:
tail -f logs/bot_$(date +%Y-%m-%d).log
The bot uses html2text to convert Qwen's rendered HTML back to Markdown. If formatting issues persist, check that the Qwen AI is following the prompt instructions.
logs/bot_YYYY-MM-DD.log

