Telegram Bot Downloader — Download Media Bot for TikTok, Instagram, YouTube & More
A Telegram bot that pulls video, photo, and audio off ten platforms — TikTok, Instagram, X, YouTube, Facebook, Threads, SoundCloud, Spotify, Pinterest, GitHub. Built on Hono, grammY, and Cloudflare Workers. Paste a link, get the file.
A high-performance media downloader Telegram bot built on Hono, grammY, and Cloudflare Workers. Paste a link from any of ten supported platforms into the chat and the bot returns the media — no app, no watermark, no redirect through an ad page.
Live at @download_media_4bot .
How to download with the bot
- Open @download_media_4bot in Telegram and tap Start.
- Paste a link from TikTok, Instagram, YouTube, X, Facebook, Threads, SoundCloud, Spotify, Pinterest or GitHub.
- Pick the quality when asked — the file arrives in the chat. No app, no signup, no ad pages.
Supported platforms
- TikTok — videos without watermark, high-quality audio, photo slideshows
- Instagram — reels, videos, photos, carousel posts, and Stories by username
- Twitter / X — HD videos and photos, plus long-form Articles and threads
- YouTube — HD/SD video and MP3 audio extraction
- Facebook — HD/SD video
- Threads — videos and photos
- SoundCloud — high-quality audio tracks
- Spotify — audio previews and track downloads
- Pinterest — videos and high-resolution images
- GitHub — repository archives, folders, and single raw files
What it does beyond fetching files
- Quality picker — an inline keyboard for platforms that expose multiple renditions, so YouTube and Facebook links do not silently hand back the worst one. Quality pickers (YouTube, TikTok, Facebook) are admin-only; guests get automatic best-quality downloads.
- Runs at the edge — Cloudflare's global network keeps the round trip short regardless of where the user is.
- Analytics — download counts and per-user tracking through Cloudflare KV and Analytics Engine, surfaced to admins via
/stats. - Bilingual — the interface detects the user's Telegram language and switches between Arabic and English.
- Subscription gate — optional required-channel check before a download is allowed, configurable by an admin at runtime, with a number of free downloads allowed before the gate (
/setfreeuses). - Self-configuring — webhook registration and bot setup run automatically after deploy; hitting
/setuponce finalizes it. - Long-form content — X Articles and self-reply threads are published to Telegraph for reading in Telegram, and returned in full as Markdown over the API/MCP.
- API & MCP server — the same downloader is exposed as a REST endpoint and as an MCP server for AI agents (see below).
Stack
Hono for the Worker's HTTP layer, grammY for the Telegram side, Cloudflare Workers for execution, Workers KV for caching and state, and Analytics Engine for real-time metrics. Tests run on Vitest; the repo enforces conventional commits and ships CodeQL and code-quality workflows on every push.
Commands
/start— show the supported platforms/help— usage instructions/story— download Instagram Stories by username (accepts@username, a plain username, or a URL)/lang— change the bot language/cancel— cancel the current action- Send a URL — that is the whole interaction; no command needed
Admin commands (scoped to the admin chat): /stats — usage statistics; /logs — recent failed downloads; /setchannel — set the required subscription channel; /setfreeuses — set free downloads allowed before the gate; /block / /unblock — block or unblock a user by ID; /allowlist — manage whitelisted domains; /broadcast — send a message to all users; /reply — reply to a user by ID; /footer — set the Instagram caption footer.
Deploying your own
You need a Cloudflare account with Workers enabled, a bot token from @BotFather , and Node.js with pnpm.
git clone https://github.com/EngDawood/download-media.git
cd download-media
pnpm install
# set your numeric Telegram ID as ADMIN_TELEGRAM_ID in wrangler.jsonc, then:
pnpm exec wrangler secret put TELEGRAM_BOT_TOKEN
pnpm exec wrangler secret put TELEGRAM_WEBHOOK_SECRET
# optional — enables the API & MCP server below; both stay disabled (503) while unset:
pnpm exec wrangler secret put PUBLIC_API_KEY
pnpm deploy Then visit https://your-worker-url/setup once to register the webhook. pnpm dev runs it locally, pnpm test runs the Vitest suite.
API & MCP server
The same downloader is exposed outside Telegram in two ways, both sharing the same pipeline, auth, and content policy as the bot. Both are disabled until PUBLIC_API_KEY is set, and both return links only — no file bytes pass through the Worker.
- REST endpoint —
POST /api/downloadwith anX-API-Keyheader and a JSON body (urlrequired;modeoptional:auto,audio,hd,sd). - MCP server —
POST /mcpspeaks the MCP Streamable HTTP transport (stateless, no sessions). Auth viaX-API-Keyheader,Authorization: Bearerheader, or as the last path segment (/mcp/<key>) for clients that cannot set custom headers. Tools:download_media,get_media_info,list_supported_platforms.
Full reference, including status codes and error semantics, lives in `CLAUDE-API.md` .
Frequently asked questions
Is this bot downloader free?
Yes — paste a link and get the file, with no signup and no ads.
Which platforms does the Telegram bot downloader support?
TikTok, Instagram, X (Twitter), YouTube, Facebook, Threads, SoundCloud, Spotify, Pinterest and GitHub — video, photo and audio, plus repository archives and raw files from GitHub.
Are TikTok videos downloaded without a watermark?
Yes, TikTok videos come back clean, with high-quality audio.
Can I download a GitHub repository?
Yes — send a repository, folder, or single raw file link and the bot returns the archive or the file.
Can I read full X Articles and threads?
Yes — long-form X content is published to Telegraph so you can read it in Telegram; the full text as Markdown is available over the API/MCP.
Is there an API or MCP server?
Yes — the same downloader is exposed as a REST endpoint (POST /api/download) and as an MCP server (POST /mcp) for AI agents. Both need a PUBLIC_API_KEY set on the Worker; see the API & MCP server section above.
Is there a file size limit?
Files are returned inside Telegram, so Telegram's own bot file limits apply; for a web version see dl.engdawood.com .
Related project: Thmanyah Font — free Arabic font for the web .
Want something like this for your team? I usually ship a first version within two weeks.
Get in touch