DEV Community

Cover image for I built a Telegram bot that downloads YouTube videos โ€” here's how it works
Andrey Sobolev
Andrey Sobolev

Posted on

I built a Telegram bot that downloads YouTube videos โ€” here's how it works

Hey DEV community! ๐Ÿ‘‹

I've been building a Telegram bot called @AndyVideoBot that downloads YouTube videos and audio directly to Telegram chat. No browser extension, no website, no login required โ€” just paste a link.

What it does

  • Video formats: 144p ยท 240p ยท 360p ยท 480p ยท 720p ยท 1080p ยท 1440p ยท 4K
  • Audio: MP3 extraction
  • Playlists โ€” download entire playlists
  • YouTube Shorts โ€” vertical video supported
  • Channel subscriptions โ€” subscribe to a channel and get new uploads delivered automatically
  • Dubbed audio selection โ€” choose language when multiple audio tracks are available
  • Smart cache โ€” if someone already downloaded the same video at the same quality, instant delivery from cache (no re-downloading)
  • Inline mode โ€” share downloads directly in any Telegram chat

Tech stack

  • Python 3.14 (free-threaded, GIL disabled)
  • Telethon โ€” Telegram MTProto client
  • yt-dlp โ€” YouTube downloading engine
  • aiosqlite โ€” async SQLite

Multi-bot architecture

The bot supports running multiple instances simultaneously sharing a single database. Each instance handles its own download queue, and files are served from a shared Telegram-based cache โ€” so if bot A downloaded a video, bot B delivers it instantly from cache.

12 languages

English, Russian, German, Spanish, French, Portuguese, Turkish, Indonesian, Hindi, Vietnamese, Kazakh, Chinese.

Try it

๐Ÿ‘‰ https://t.me/AndyVideoBot

Top comments (0)