Instagram Downloader (instagram-downloader)
Downloads high-resolution images, carousels, or reels from Instagram URLs using agent-browser.
Prerequisites
- Requires
agent-browserto be installed and configured in the system path.
Parameters
| Parameter | Required | Description |
|---|---|---|
url |
Yes | The Instagram post or reel URL |
--pdf |
No | Stitch carousel images into a single PDF |
Step-by-Step Instructions
1. Launch Agent Browser
Run the following command to open the Instagram post:
agent-browser open "{url}"
2. Extract Media Source URLs
- Inspect the page elements to find
<img src="...">and<video src="...">tags. - For carousels, use
agent-browserto click the next/right arrow button (typically targets with attributes likearia-label="Next"or class names containing chevron/arrow) to load all slides into the DOM. - Identify the high-resolution source URLs hosted on
*.cdninstagram.com.
3. Download the Files
- Download each extracted URL using curl/wget or standard file write tools:
curl -o "slide_N.jpg" "{cdn_url}" - Save them into a folder named after the post's caption or date.
4. Optional PDF Stitching
If the --pdf flag is provided and the post is a carousel:
- Use python or local image tools to stitch the downloaded
slide_N.jpgfiles into a single PDF namedcarousel.pdf.