Skip to content

cccaaannn/telegram_youtube_downloader

Repository files navigation

Telegram YouTube downloader


Telegram bot for downloading video or audio from multiple sites, you can run it with single command.

GitHub top language GitHub release GitHub Docker Pulls Docker Image Size (tag)

Overview

Demo

drawing drawing


Commands

⏬ Download commands
/video <download url>
/video <format> <download url>
/v <download url>
/audio <download url>
/audio <format> <download url>
/a <download url>
🔎 Search command

Performs a YouTube search to download. See setup/search

/search <query>
/s <query>
⚙️ Utility commands

See configurations for command configurations.

/formats
/sites
/help
/about

Running

🚀 Simple usage with Docker. (To run without docker see setup)

docker run -d --name telegram_youtube_downloader --restart unless-stopped -e TELEGRAM_BOT_KEY=<TELEGRAM_BOT_KEY> cccaaannn/telegram_youtube_downloader:latest
🏠 Example with default command

You can set a default command to run a download command on bare messages.

docker run -d --name telegram_youtube_downloader --restart unless-stopped \
-e TELEGRAM_BOT_KEY=<TELEGRAM_BOT_KEY> \
-e telegram_bot_options__default_command=video \
cccaaannn/telegram_youtube_downloader:latest
🔑 Example with authorization

You can set authorization rules per user see authorization config. If you have many users you can map the configs directory to a local directory and edit the config file.

docker run -d --name telegram_youtube_downloader --restart unless-stopped \
-e TELEGRAM_BOT_KEY=<TELEGRAM_BOT_KEY> \
-e telegram_bot_options__authorization_options__mode=ALLOW_SELECTED \
-e telegram_bot_options__authorization_options__users__0__claims=all \
-e telegram_bot_options__authorization_options__users__0__id=<TELEGRAM_USER_ID_1> \
-e telegram_bot_options__authorization_options__users__1__claims=audio,help \
-e telegram_bot_options__authorization_options__users__1__id=<TELEGRAM_USER_ID_2> \
cccaaannn/telegram_youtube_downloader:latest
💾 Example with mapped volumes
  1. You can map logs to a local directory. See logger options.
  2. You can also map the configs directory to a local directory if you have too many custom configurations.
docker run -d --name telegram_youtube_downloader --restart unless-stopped \
-e TELEGRAM_BOT_KEY=<TELEGRAM_BOT_KEY> \
-v <YOUR_LOGS_PATH>/logs:/app/logs \
-v <YOUR_CONFIGS_PATH>/configs:/app/telegram_youtube_downloader/configs \
cccaaannn/telegram_youtube_downloader:latest
🔎 Example with search

You can use search command to search videos on YouTube. See search feature.

docker run -d --name telegram_youtube_downloader --restart unless-stopped \
-e TELEGRAM_BOT_KEY=<TELEGRAM_BOT_KEY> \
-e YOUTUBE_API_KEY=<YOUTUBE_API_KEY> \
cccaaannn/telegram_youtube_downloader:latest
🍪 Example with cookie file

You can use a cookie file to download without getting blocked.

docker run -d --name telegram_youtube_downloader --restart unless-stopped \
-e TELEGRAM_BOT_KEY=<TELEGRAM_BOT_KEY> \
-e youtube_downloader_options__audio_options__cookiefile=/app/cookies/cookies.txt \
-e youtube_downloader_options__video_options__cookiefile=/app/cookies/cookies.txt \
-v <YOUR_COOKIES_PATH>/cookies:/app/cookies \
cccaaannn/telegram_youtube_downloader:latest
🪪 Example with PO token

You can use visitor data and PO token on downloads to bypass blocking on some sites.

docker run -d --name telegram_youtube_downloader --restart unless-stopped \
-e TELEGRAM_BOT_KEY=<TELEGRAM_BOT_KEY> \
-e youtube_downloader_options__audio_options__extractor_args='"youtubetab:skip=webpage;youtube:player_skip=webpage,configs;visitor_data=<VISITOR_DATA>;youtube:po_token=web.gvs+<PO_TOKEN>"' \
-e youtube_downloader_options__video_options__extractor_args='"youtubetab:skip=webpage;youtube:player_skip=webpage,configs;visitor_data=<VISITOR_DATA>;youtube:po_token=web.gvs+<PO_TOKEN>"' \
cccaaannn/telegram_youtube_downloader:latest
🐳 Example with compose

You can use docker compose to run. See docker compose.

  • Copy compose/.env.template to compose/.env, add your TELEGRAM_BOT_KEY
docker compose -f compose/default.yaml up -d
🏗️ Example with terraform

You can use terraform to deploy the bot. See setup/terraform

cd terraform/aws
terraform init
terraform apply

Daily build

This project depends on yt-dlp and it is constantly updated, a daily Docker build pipeline added to keep the project up to date with external dependencies. It is not tested so might not be stable but if you are getting download errors on the latest version you can use daily until latest is fixed.

docker run -d --name telegram_youtube_downloader --restart unless-stopped -e TELEGRAM_BOT_KEY=<TELEGRAM_BOT_KEY> cccaaannn/telegram_youtube_downloader:daily

Docs