MediaKit is a Telegram bot for media downloading, cached delivery, and voice/video-note transcription.
Python+python-telegram-botfor Telegram polling and handlersPostgreSQL(asyncpg) for request log and media cache (file_id)yt-dlp+ffmpegfor download and conversion pipelinesYandex SpeechKit+YandexGPTfor speech-to-text and summarization- Local Telegram Bot API support via
telegram.api_base_url
- Download media from:
- YouTube, Instagram, TikTok, Reddit, PornHub, Pinterest
- Yandex Music, Spotify, YouTube Music
- Normalize links for stable DB cache hits
- Reuse cached
file_idwhen possible (faster repeat delivery) - Voice/video-note transcription and summary
- Admin panel for chat list, direct message, and broadcast
- Background cleanup for temporary files
To prevent replay storms after restart, the bot intentionally drops stale updates.
drop_pending_updates=Trueis enabled at polling startup.features.max_update_age_secis set to300(5 minutes).
What this means:
- If the bot is down and a message waits too long (older than 5 minutes), that update can be skipped after restart.
- This is by design to avoid repeated old downloads/transcriptions.
- Users can resend links/messages if they were sent during downtime and got skipped.
This is update-age logic, not content deduplication by text.
Main config file: important/config.json
telegram: token, admin ID, API base URL, request timeoutsdatabase: PostgreSQL connection settingsnetwork: proxies, cookies, and headersintegrations: RapidAPI, Reddit, Yandex serviceslimits: upload size, concurrency, cleanup intervalsdownloads: yt-dlp default format and socket timeoutmessages: all user-facing status and error stringsfeatures: excluded chats, exact matches, skip-conversion list, stale-update window
Current skip-conversion list:
- YouTube
- TikTok
- PornHub
- Clone repository:
git clone https://github.com/JohnGenri/MediaKit.git
cd MediaKit- Install dependencies to system Python:
python3 -m pip install --break-system-packages --ignore-installed -r requirements.txt- Prepare runtime files:
cp download_instagram.sh.example download_instagram.sh
chmod +x download_instagram.sh
cp important/config.json.example important/config.json- Fill
important/config.jsonwith valid credentials and tokens.
[Unit]
Description=MediaKit Telegram Bot
After=network.target
[Service]
User=root
Group=root
WorkingDirectory=/root/BOTS/MediaKit
Environment=PYTHONDONTWRITEBYTECODE=1
ExecStart=/usr/bin/python3 /root/BOTS/MediaKit/MediaKit.py
Restart=always
RestartSec=5s
[Install]
WantedBy=multi-user.targetUseful commands:
systemctl daemon-reload
systemctl enable mediakit.service
systemctl restart mediakit.service
systemctl status mediakit.service
journalctl -u mediakit -f