Skip to content

magicxor/ytdl-inline-bot

Repository files navigation

ytdl-inline-bot

Update Dependencies master branch - check types, build, push Ask DeepWiki

A Telegram bot that allows users to download videos from YouTube via inline queries. It uses yt-dlp under the hood to fetch and download videos.

Demo.mp4

Usage

docker run -i -t -d --restart=always --name=youtube_telegram_inline_bot -e TELEGRAM_BOT_TOKEN='YOUR_TOKEN' -e MEDIA_CHAT_ID=345347562 magicxor/ytdl-inline-bot:latest

Environment variables

Required

  • TELEGRAM_BOT_TOKEN - Telegram bot token.
  • MEDIA_CHAT_ID - chat ID where the bot will send temporary media files.

Optional

  • MAX_VIDEO_SIZE - target video size in bytes that should be downloaded. Default is 15 megabytes (15728640 bytes). In case the video is larger than this value, the bot will pick the smallest available format.
  • MAX_AUDIO_SIZE - target audio size in bytes that should be downloaded. Default is 8 megabytes (8388608 bytes). In case the audio is larger than this value, the bot will pick the smallest available format.
  • MAX_TG_FILE_SIZE - maximum file size in bytes that can be uploaded to Telegram. Default is 50 megabytes (52428800 bytes).
  • VIP_USER_ID - user ID that is allowed to download videos without rate limit.
  • RATE_LIMIT_WINDOW_MINUTES - rate limit window in minutes. Default is 1 minute.
  • PREFERRED_AUDIO_LANGUAGES - comma-separated list of preferred audio languages. Default is "en-US,en,ru-RU,ru".
  • BOT_COOKIES_BASE64 - base64-encoded cookies for yt-dlp to bypass age restrictions or access private videos.
  • BOT_USER_AGENT - custom User-Agent string for yt-dlp requests.

Error video parameters

These parameters define the video shown when an error occurs:

Placeholder video parameters

These parameters define the video shown while the requested video is being downloaded:

About

A Telegram bot that allows users to download videos from YouTube via inline queries

Topics

Resources

License

Stars

Watchers

Forks