Supported content
The bot can download from:- Posts - Single images or videos
- Reels - Short-form videos
- Carousels - Multiple images/videos in a single post
- TV videos - IGTV content
URL patterns
Supported Instagram URL formats:https://www.instagram.com/p/ABC123/https://www.instagram.com/reel/XYZ789/https://instagram.com/tv/DEF456/
RapidAPI integration
The bot uses the Instagram Downloader API from RapidAPI:API host
Configuration
Set your RapidAPI key in.env:
Usage examples
Download Instagram video
Send an Instagram URL to the bot:- Detects Instagram URL pattern
- Calls RapidAPI to extract media info
- Downloads video and thumbnail in parallel
- Sends video back to user
Download Instagram carousel
Carousels with multiple images/videos are handled automatically:- Downloads all items in parallel
- Converts HEIC/non-native images to PNG
- Sends in batches of 10 (Telegram limit)
- Group chats limited to 10 items
File mode vs. photo mode
Users can toggle between sending as files or compressed photos:Error handling
The bot handles various Instagram API errors:404 - Not found
- Post was deleted
- Post is private
- Invalid URL
429 - Rate limit
Network errors
Image processing
The bot automatically converts non-native image formats:Supported native formats
Inline mode support
Instagram content works in inline mode for sharing in any chat:Storage channel requirement
Inline mode requires uploading to a storage channel first to get file IDs:STORAGE_CHANNEL_ID in .env to enable inline mode.
Response format
The RapidAPI response includes:type- “image” or “video”url- Direct download URLthumbnail- Thumbnail URL (for videos)quality- Media quality indicator
Performance
Parallel downloads
All carousel items download in parallel:Image conversion
Image conversion runs in thread pool to avoid blocking:Batched sending
Large carousels are split into batches of 10:Database logging
All Instagram downloads are logged to the database:is_images flag distinguishes between video and image posts for statistics.
