Instagram Comments Scraper avatar
Instagram Comments Scraper

Pricing

$19.99/month + usage

Go to Apify Store
Instagram Comments Scraper

Instagram Comments Scraper

Instagram Comments Scraper extracts comments from any public Instagram post. Capture usernames, text, timestamps, likes, and replies in structured format. Ideal for sentiment analysis, research, audience insights, and automated workflows needing clean comment data.

Pricing

$19.99/month + usage

Rating

0.0

(0)

Developer

API Empire

API Empire

Maintained by Community

Actor stats

0

Bookmarked

3

Total users

2

Monthly active users

3 days ago

Last modified

Share

A powerful Apify Actor that scrapes comments from Instagram posts, reels, and IGTV videos. Supports multiple input formats including post URLs, shortcodes, and usernames with automatic latest post detection.

๐Ÿš€ Why Choose This Actor?

  • Multiple Input Formats: Accept post URLs, shortcodes, or usernames (automatically fetches latest post)
  • Smart Proxy Strategy: Collects first 15 comments without proxy, then switches to residential proxy for remaining data
  • Flexible Sorting: Sort comments by popularity (most liked) or time (newest first)
  • Bulk Processing: Process multiple posts in a single run
  • Robust Error Handling: Automatic retries and proxy fallback mechanisms
  • Detailed Logging: Real-time progress updates throughout the scraping process

โœจ Key Features

  • โœ… Scrape comments from Instagram posts, reels, and IGTV videos
  • โœ… Support for usernames (automatically fetches latest post)
  • โœ… Customizable comment limit (1-10,000 per post)
  • โœ… Two sort orders: popular (most liked) or time (newest first)
  • โœ… Automatic proxy fallback: no proxy โ†’ datacenter โ†’ residential
  • โœ… Session management with automatic credential refresh
  • โœ… Pagination support for large comment threads
  • โœ… Bulk URL processing with rate limiting

๐Ÿ“ฅ Input

Input Schema

{
"startUrls": [
"https://www.instagram.com/p/DN8-GjPkgjS/",
"DN8-GjPkgjS",
"iamsrk"
],
"sortOrder": "popular",
"maxComments": 200,
"proxyConfiguration": {
"useApifyProxy": false
}
}

Input Parameters

ParameterTypeRequiredDefaultDescription
startUrlsArrayโœ… Yes-List of Instagram post URLs, shortcodes, or usernames. Supports multiple formats:
โ€ข Full URLs: https://www.instagram.com/p/SHORTCODE/
โ€ข Shortcodes: DN8-GjPkgjS
โ€ข Usernames: iamsrk (fetches latest post automatically)
sortOrderStringโŒ No"popular"How to sort comments:
โ€ข "popular" - Most liked comments first
โ€ข "time" - Newest comments first
maxCommentsIntegerโŒ No10Maximum number of comments to scrape per post (1-10,000)
proxyConfigurationObjectโŒ No{"useApifyProxy": false}Proxy settings. By default, no proxy is used. The actor uses a smart strategy:
โ€ข First 15 comments: No proxy
โ€ข Remaining comments: Residential proxy (if configured)

Input Examples

Example 1: Multiple Post URLs

{
"startUrls": [
"https://www.instagram.com/p/DN8-GjPkgjS/",
"https://www.instagram.com/p/ABC123xyz/"
],
"maxComments": 100,
"sortOrder": "popular"
}

Example 2: Shortcodes

{
"startUrls": [
"DN8-GjPkgjS",
"ABC123xyz"
],
"maxComments": 50
}

Example 3: Usernames (Latest Post)

{
"startUrls": [
"iamsrk",
"mrbeast",
"cristiano"
],
"maxComments": 200,
"sortOrder": "time"
}

Example 4: Mixed Input

{
"startUrls": [
"https://www.instagram.com/p/DN8-GjPkgjS/",
"ABC123xyz",
"iamsrk"
],
"maxComments": 500,
"sortOrder": "popular"
}

๐Ÿ“ค Output

Comments are saved to the dataset with the following structure:

Output Schema

{
"id": "1234567890",
"text": "Amazing post! ๐Ÿ”ฅ",
"timestamp": "2024-01-15T10:30:00Z",
"ownerUsername": "commenter_username",
"ownerProfilePicUrl": "https://instagram.com/...",
"postUrl": "https://www.instagram.com/p/DN8-GjPkgjS/"
}

Output Fields

FieldTypeDescription
idStringUnique comment ID (Instagram PK)
textStringComment text content
timestampStringISO 8601 formatted timestamp (e.g., 2024-01-15T10:30:00Z)
ownerUsernameStringUsername of the comment author
ownerProfilePicUrlStringURL to the commenter's profile picture
postUrlStringOriginal Instagram post URL

Output Example

[
{
"id": "1234567890",
"text": "This is amazing! ๐Ÿ”ฅ",
"timestamp": "2024-01-15T10:30:00Z",
"ownerUsername": "fan_account",
"ownerProfilePicUrl": "https://scontent.cdninstagram.com/v/...",
"postUrl": "https://www.instagram.com/p/DN8-GjPkgjS/"
},
{
"id": "9876543210",
"text": "Love this! โค๏ธ",
"timestamp": "2024-01-15T10:25:00Z",
"ownerUsername": "another_user",
"ownerProfilePicUrl": "https://scontent.cdninstagram.com/v/...",
"postUrl": "https://www.instagram.com/p/DN8-GjPkgjS/"
}
]

๐ŸŽฏ How to Use the Actor

Step 1: Open the Actor

  1. Go to the Apify Console
  2. Navigate to the Instagram Comments Scraper actor
  3. Click Start to create a new run

Step 2: Configure Input

  1. Enter Post URLs, Shortcodes, or Usernames:

    • For post URLs: https://www.instagram.com/p/SHORTCODE/
    • For shortcodes: DN8-GjPkgjS
    • For usernames: iamsrk (will fetch latest post automatically)
  2. Set Maximum Comments:

    • Enter the number of comments to scrape per post (1-10,000)
    • Default: 10
  3. Choose Sort Order:

    • popular - Most liked comments first (default)
    • time - Newest comments first
  4. Configure Proxy (Optional):

    • By default, no proxy is used
    • The actor automatically uses residential proxy after collecting first 15 comments
    • Enable Apify Proxy if you need consistent proxy usage

Step 3: Run the Actor

  1. Click Start to begin scraping
  2. Monitor progress in the Log tab
  3. View results in the Dataset tab when complete

Step 4: Export Results

  1. Go to the Dataset tab
  2. Click Export to download results as:
    • JSON
    • CSV
    • Excel
    • XML

๐Ÿ”ง Proxy Strategy

The actor uses an intelligent proxy strategy to optimize performance and costs:

  1. Initial Requests (First 15 Comments): No proxy used

    • Faster and free
    • Works for most public posts
  2. Remaining Comments: Residential proxy (if configured)

    • Automatically switches after collecting 15 comments
    • Ensures reliable data collection for larger comment threads
    • Handles rate limits and blocks
  3. Automatic Fallback:

    • If a request fails, the actor automatically retries
    • Switches to residential proxy if needed
    • Refreshes session credentials on 401 errors

๐Ÿ’ก Best Use Cases

  • Social Media Monitoring: Track comments on brand posts or competitor content
  • Sentiment Analysis: Collect comments for NLP and sentiment analysis
  • Engagement Research: Analyze comment patterns and user engagement
  • Content Moderation: Monitor comments for moderation purposes
  • Market Research: Gather user feedback and opinions from Instagram posts
  • Influencer Analytics: Analyze comment engagement on influencer posts

โ“ Frequently Asked Questions

Can I scrape comments from private accounts?

No, this actor only works with public Instagram posts. Private accounts require authentication and are not supported.

What happens if I provide a username?

The actor will:

  1. Fetch the user's profile page
  2. Extract the URL of their latest post
  3. Scrape comments from that post

How many comments can I scrape per post?

You can scrape up to 10,000 comments per post. Set maxComments to your desired limit.

Does the actor handle rate limiting?

Yes! The actor includes:

  • Automatic retries with exponential backoff
  • Proxy fallback mechanisms
  • Session credential refresh on authentication errors
  • Rate limiting delays between requests

Can I scrape comments from reels and IGTV?

Yes! The actor supports:

  • Regular posts: https://www.instagram.com/p/SHORTCODE/
  • Reels: https://www.instagram.com/reel/SHORTCODE/
  • IGTV: https://www.instagram.com/tv/SHORTCODE/

What if a post has no comments?

The actor will log a warning and continue to the next post. No data will be saved for posts without comments.

How long does scraping take?

Scraping time depends on:

  • Number of posts to process
  • Number of comments per post
  • Network speed and proxy latency

Typically, 100 comments take 1-2 minutes per post.

โš ๏ธ Important Notes

  • Rate Limiting: Instagram may rate limit requests. The actor includes automatic retries and delays.
  • Public Posts Only: Only public Instagram posts can be scraped.
  • Legal Compliance: Ensure you comply with Instagram's Terms of Service and applicable data protection laws.
  • Data Usage: Use scraped data responsibly and in accordance with privacy regulations.

๐Ÿ› Troubleshooting

No comments collected

Possible causes:

  • Post is private or deleted
  • Post has no comments
  • Instagram blocked the request

Solutions:

  • Verify the post URL is correct and public
  • Enable proxy configuration
  • Check the actor logs for detailed error messages

"Failed to get document ID" error

Possible causes:

  • Instagram changed their API structure
  • Request was blocked

Solutions:

  • Enable residential proxy
  • Try again after a few minutes
  • Check if the post URL is valid

"Session expired (401)" error

Solution: The actor automatically refreshes session credentials. If the error persists, enable proxy configuration.

๐Ÿ“ž Support

For issues, questions, or feature requests, please contact support or open an issue in the actor repository.


Version: 0.1
Last Updated: 2024