Skip to main content

Download Post Media

Downloads media files (images and videos) from an Instagram post to a local directory. Supports both single posts and carousel posts with multiple images/videos.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Session ID - The session identifier from the Login node.
  • Post Shortcode - The post shortcode (e.g., "CxYz123") or full Instagram post URL (e.g., "https://www.instagram.com/p/CxYz123/").
  • Output Directory - Local directory path where downloaded media files will be saved. The directory will be created if it doesn't exist.

Options

  • Download Videos - Download video files from the post. Default is true.
  • Download Images - Download image files from the post. Default is true.

Output

  • Downloaded Files - Array of absolute file paths for all successfully downloaded media files.
  • File Count - Total number of files downloaded.

How It Works

The Download Post Media node retrieves and saves media from Instagram posts. When executed, it:

  1. Validates the Session ID, Post Shortcode, and Output Directory
  2. Extracts the shortcode from the URL if a full URL was provided
  3. Creates the output directory if it doesn't exist
  4. Retrieves the post data using the Instagram API
  5. For carousel posts, iterates through all sidecar nodes
  6. Downloads each media file (video or image) based on options
  7. Names files using the pattern: {shortcode}_{index}.{extension}
  8. Returns array of downloaded file paths and count

Requirements

  • An active Instagram session (from Login node)
  • A valid post shortcode or Instagram post URL
  • Write permissions to the output directory
  • Sufficient disk space for the media files

Error Handling

The node will return specific errors in the following cases:

  • ErrInvalidArg - Post shortcode or output directory is missing
  • ErrNotFound - Post does not exist or was deleted
  • ErrNetwork - Failed to download media (network error)
  • ErrRuntime - General failure (file system errors, etc.)

Common Errors

Post Not Found:

Post with shortcode 'CxYz123' not found

Solution: Verify the shortcode/URL is correct and the post exists.

Network Error:

Failed to download media: Connection timeout

Solution: Check internet connection and retry.

File System Error:

Failed to download media: Permission denied

Solution: Ensure write permissions for the output directory.

Usage Notes

  • Files are named {shortcode}.jpg for single image posts
  • Files are named {shortcode}.mp4 for single video posts
  • Carousel items are named {shortcode}_1.jpg, {shortcode}_2.mp4, etc.
  • The output directory is created automatically if it doesn't exist
  • Both options can be enabled to download all media types
  • Disable one option to selectively download only images or videos
  • Downloaded files are not overwritten; existing files are replaced

Example: Download Post Images

Inputs:

Options:

  • Download Videos: false
  • Download Images: true

Output:

{
"downloaded_files": [
"/downloads/instagram/posts/CxYz123_1.jpg",
"/downloads/instagram/posts/CxYz123_2.jpg",
"/downloads/instagram/posts/CxYz123_3.jpg"
],
"files_count": 3
}

Use Case: Archive only images from a carousel post, skipping videos.

Example: Archive User-Generated Content

Workflow:

Search Hashtag (#yourbrand, max: 50)

For each post:
Download Post Media

Output Directory: "./ugc/{shortcode}"
Download Videos: true
Download Images: true

Organize and review downloaded content

Use Case: Collect user-generated content featuring your brand.

Example: Competitor Content Analysis

Workflow:

Get Profile Posts (competitor, max: 100)

For each post:
Download Post Media

Output Directory: "./competitor_media/{date}"

Analyze visual content trends

Use Case: Archive competitor content for market research.

Example: Campaign Content Collection

Workflow:

Login

Read post URLs from file/database

For each URL:
Download Post Media

Output Directory: "./campaign/{campaign_name}"
Download Videos: true
Download Images: true

Generate campaign content archive

Logout

Best Practices

  • Use descriptive output directory names (e.g., "./downloads/2024-01-15/campaign")
  • Enable only the media types you need to save bandwidth and storage
  • Check available disk space before bulk downloads
  • Create dated subdirectories for organization
  • Handle download errors gracefully (network issues, deleted posts)
  • Keep track of downloaded shortcodes to avoid duplicates
  • Clean up old downloads periodically to manage disk space
  • Use absolute paths for output directories to avoid confusion

Tips for Effective Use

  • Organization: Use subdirectories for different campaigns, dates, or sources
  • File Naming: The automatic naming includes index for carousel items
  • Selective Downloads: Disable videos if you only need images (saves bandwidth)
  • Batch Processing: Download multiple posts in a loop with error handling
  • Storage Planning: Videos can be large; plan storage accordingly
  • Metadata Storage: Save post metadata alongside downloaded files
  • Duplicate Prevention: Check if files exist before re-downloading
  • Progress Tracking: Log downloaded file paths for audit trail

Common Use Cases

  1. Content Archival - Backup important posts before they're deleted
  2. User-Generated Content - Collect customer photos/videos featuring your brand
  3. Competitive Analysis - Archive competitor content for research
  4. Campaign Collection - Gather influencer campaign content
  5. Media Library Building - Create a library of industry-relevant content
  6. Social Proof Collection - Archive testimonials and reviews
  7. Trend Analysis - Download viral content for pattern analysis
  8. Legal Compliance - Archive sponsored content for regulatory requirements

File Naming Patterns

Single Image Post:

CxYz123.jpg

Single Video Post:

CxYz123.mp4

Carousel Post (3 items: 2 images, 1 video):

CxYz123_1.jpg
CxYz123_2.jpg
CxYz123_3.mp4

Example: Organize Downloads by Date

Workflow:

Get Profile Posts (target_account, max: 50)

For each post:
Extract date from post data
Create directory: "./media/{username}/{year}/{month}"

Download Post Media
Output Directory: (dynamic path created above)

Result: Media organized by year and month

Performance Considerations

  • Image downloads are typically fast (1-5 seconds per image)
  • Video downloads depend on file size (can take 10-60 seconds)
  • Carousel posts with many items take longer
  • Network speed significantly impacts download time
  • Consider rate limiting when downloading many posts
  • Use parallel downloads cautiously to avoid overwhelming the network
  • Monitor disk space when downloading large batches

Storage Requirements

Approximate File Sizes:

  • Single image: 100KB - 2MB
  • Carousel images: 300KB - 6MB total
  • Short video (15s): 2-5MB
  • Reel (30-60s): 5-15MB
  • High-quality video: Can exceed 50MB

Planning:

  • 100 image posts: ~100-200MB
  • 100 video posts: ~500MB - 2GB
  • Mixed content (typical): ~300-800MB per 100 posts

Output Directory Examples

By Campaign:

./downloads/summer_campaign_2024/
├── CxYz123_1.jpg
├── CxYz123_2.jpg
└── CxYz124.mp4

By Date:

./media/2024/01/15/
├── CxYz123.jpg
└── CxYz124.mp4

By Source:

./ugc/brand_hashtag/
├── CxYz123.jpg
└── CxYz124.jpg

Important Notes

  • URL Extraction: The node automatically extracts shortcodes from full URLs
  • Carousel Support: All items in carousel posts are downloaded sequentially
  • File Replacement: Existing files with the same name are overwritten
  • Directory Creation: Output directory is created automatically if missing
  • Media Types: Both images (.jpg) and videos (.mp4) are supported
  • Network Dependency: Requires stable internet connection for downloads
  • Post Availability: Deleted posts cannot be downloaded (ErrNotFound)
  • Rate Limiting: Excessive downloads may trigger Instagram rate limits
  • File Extensions: .jpg for images, .mp4 for videos
  • Index Numbering: Carousel items numbered sequentially from 1