Bot receives messages with URLs, downloads media using yt-dlp and sends the files back to the user.
Text messages from the bot appear only in case of errors (or when a file cannot be sent).
Supported use cases (depends on yt-dlp support):
- Short video from TikTok / Instagram / Threads / YouTube Shorts and other sites.
- Media that is visible only to logged‑in / age‑verified users (using cookies).
- Audio tracks from Spotify / SoundCloud / YouTube Music converted to MP3 (where technically possible).
For age‑restricted or private videos that are visible only to logged‑in users, the bot can use a cookie file exported from your browser.
- Install dependencies:
cd /home/dima/Work/var/PythonSaverBot
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt- (Optional) Prepare cookies for age‑restricted/private media:
- Install a browser extension like Get cookies.txt (or similar).
- Log into the services you need (TikTok, YouTube, Instagram, etc.).
- On any page of the corresponding site, export cookies to a file, for example
cookies.txt.
- Export environment variables:
export TELEGRAM_BOT_TOKEN="123456:ABCDEF..."
# if you have a cookie file:
export YTDLP_COOKIE_FILE="/absolute/path/to/cookies.txt"- Run the bot:
python bot.py- Build the image:
cd /home/dima/Work/var/PythonSaverBot
docker build -t tg-media-bot .- Run the container:
docker run -d \
--name tg-media-bot \
-e TELEGRAM_BOT_TOKEN="123456:ABCDEF..." \
-e YTDLP_COOKIE_FILE="/app/cookies.txt" \
-v /absolute/host/path/cookies.txt:/app/cookies.txt:ro \
tg-media-botThe bot uses long polling and will automatically process new messages.