project2026

AR-3972 Media Downloader Bot

GoTelegram Bot APIyt-dlpffmpegDockerPostHog
AR-3972 Media Downloader Bot

The Problem

Every day, people share videos across YouTube, TikTok, Twitter/X, Instagram, Reddit, and dozens of other platforms. Saving them usually means wrestling with ads, sketchy websites, or copy-pasting URLs into cluttered apps. I wanted a simple, private Telegram bot that just works — send a URL, get the video back.

The Idea

A Telegram bot that downloads media from almost any platform and sends it straight back to the chat. No ads, no tracking, no account required. Just send the link.

Building It

The bot is written in Go with a modular layout: `bot` for Telegram interactions, `downloader` for the yt-dlp/ffmpeg pipeline, `analytics` for event tracking, and `config` for environment management. The downloader spawns a temporary directory per request, uses a semaphore to cap concurrent downloads, and cleans up after itself.

Key features that shaped the build:

  • **Quality picker**: after fetching video info, the bot presents available resolutions with estimated sizes so users can pick exactly what they want.
  • **Group & channel support**: the bot responds when mentioned in groups (`@botname URL`) and can be added to channels as an admin to auto-download every posted URL.
  • **Progress updates**: during downloads, the status message is edited live with the percentage parsed from yt-dlp's output.
  • **Reply-to-redownload**: users can reply to a sent video with `audio` or `info` to re-download it in another format without resending the URL.
  • **PostHog analytics**: download starts, successes, failures, info requests, and chat-type breakdowns are tracked asynchronously.
  • **Resilience**: timeouts, retries for transient Twitter/X auth issues, file-size checks before sending, and graceful fallback to audio-only when every video format is too large.

The Stack

Go, Telegram Bot API, yt-dlp, ffmpeg, Docker, PostHog.

What's Next

Thumbnail previews in the quality picker, queue position tracking when downloads are backed up, and per-user daily rate limits for public deployments.