Why I Built This
WhyIBuiltThis
Saving videos from TikTok, Twitter/X, or Instagram meant leaving the app, hunting down a third-party downloader site, and fighting through ads β just to get a file you'd immediately share in Telegram anyway.
Repeated requests for the same viral URLs hammered slow upstream APIs, adding unnecessary latency and putting rate-limit pressure on every single lookup regardless of how recently it was fetched not to even talk about the veery annoying ads.
My Approach
MyApproach
I built a Telegram bot that accepts any supported social media URL and instantly delivers the video or slideshow back into the chat β no extra apps, no manual downloads, no friction.
A provider registry keeps each platform's extraction logic fully isolated behind a shared interface, while an in-memory cache with TTL and entry-count limits absorbs repeat requests and shields the upstream APIs from redundant calls.
Key Features
KeyFeatures
- HD Multi-platform media extraction across TikTok, Twitter/X, and Instagram
- Very fast Media extraction
- Image and Video support for all supported platforms
- Zero-disk streaming β media is piped straight to Telegram, never written to disk
- Twitter/X bitrate-ranked quality fallbacks with automatic Telegram-safe retries
- In-memory caching with TTL, max-entry cap, and periodic cleanup for fast repeat requests
How the System Works
HowtheSystemWorks
The bot is built around a clean separation between the Telegram interaction layer and a provider-driven media extraction pipeline, so adding a new platform only requires registering a new provider.
- The user sends a TikTok, Twitter/X, or Instagram URL in Telegram.
- BotUpdate resolves the platform through the provider registry and immediately replies with a β³ status message so the user knows the request is in flight.
- DownloadService checks the in-memory cache; on a miss it delegates to the matched platform provider.
- The provider calls its upstream API (TikWM, FixTweet, or instagram-url-direct), normalizes the response into a unified MediaInfo model, and returns it.
- For videos, the bot streams the URL directly to Telegram; for Twitter/X it steps through MP4 variants sorted by bitrate descending until one is accepted.
- For slideshows, images are chunked into Telegram media groups of up to 10 to respect API limits.
- The temporary β³ message is deleted, and a 'Share with friends' inline button is appended to every successful video reply.
Engineering Challenges & Lessons Learned
EngineeringChallenges&LessonsLearned
Difficulty finding stable APIs and Packages that scrapes the media data to return a CDN link to acheive stability and low latency
Telegram silently rejects video files that exceed its size limits, so Twitter/X delivery required sorting all MP4 variants by bitrate descending and retrying each in sequence until one succeeded β without breaking the media-group batching behavior used by every other platform.
Instagram's extraction library returns two structurally different payload shapes depending on content type, which forced a normalization layer that maps both formats onto a single internal model before any downstream logic can safely run.
What Iβd Improve Next
WhatIβdImproveNext
- Swap the in-memory cache for Redis to support horizontal scaling and survive process restarts without losing warm cache state.
- Add other media integrations such as Youtube, Snapchat etc
