InstagramClient
TheInstagramClient class provides methods to fetch Instagram media content using the RapidAPI Instagram Downloader service.
Integration
The client integrates with RapidAPI’s Instagram Downloader service:- RapidAPI Host:
instagram-downloader-download-instagram-stories-videos4.p.rapidapi.com - Endpoint:
/convert - Authentication: API key via
X-Rapidapi-Keyheader
Methods
get_media
Fetches media information from an Instagram URL.The Instagram post URL (supports posts, reels, TV, and stories formats)
Exceptions
The method raises the following exceptions:InstagramNotFoundError- Post not found, deleted, or private (HTTP 404)InstagramRateLimitError- API rate limit exceeded (HTTP 429)InstagramNetworkError- Network errors or unexpected API responses
Example Usage
Configuration
The client requires a RapidAPI key to be configured:config["instagram"]["rapidapi_key"].
URL Format
The client accepts Instagram URLs matching the pattern:- Posts:
/p/... - Reels:
/reel/,/reels/ - TV:
/tv/... - Stories:
/stories/...

