# 🌟 Instagram Comment Sentiment Analyzer (`databuddy/instagram-comment-sentiment-analyzer`) Actor

- **URL**: https://apify.com/databuddy/instagram-comment-sentiment-analyzer.md
- **Developed by:** [Sarthak](https://apify.com/databuddy) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Instagram Comment Sentiment Analyzer 💬📊

Automatically scrape comments from any public Instagram post and get **AI-powered sentiment analysis** for each comment. Perfect for brand monitoring, influencer analysis, campaign performance tracking, and social listening.

### What does it do?

This actor takes Instagram post URLs and:

1. **Scrapes all comments** (and optionally replies) from each post
2. **Analyzes sentiment** of every comment using NLP
3. **Detects emotions** (joy, anger, sadness, surprise, trust, etc.)
4. **Understands social media slang** — recognizes "fire 🔥", "slay", "mid", "cap" and 100+ Gen-Z/social media terms
5. **Outputs structured JSON** with scores, labels, and engagement metrics

No Instagram login required — works with public posts only.

### Why use this instead of a basic scraper?

| Feature | Basic Scrapers | This Actor |
|---------|---------------|------------|
| Scrape comments | ✅ | ✅ |
| Sentiment scores | ❌ | ✅ |
| Emotion detection | ❌ | ✅ |
| Social media slang | ❌ | ✅ |
| Emoji analysis | ❌ | ✅ |
| Post-level summaries | ❌ | ✅ |
| Pay-per-use pricing | ❌ | ✅ |

### Input

| Field | Type | Description | Default |
|-------|------|-------------|---------|
| `postUrls` | Array of strings | Instagram post URLs to analyze | Required |
| `maxComments` | Integer | Max comments per post (0 = all) | 100 |
| `includeReplies` | Boolean | Also analyze reply comments | false |
| `sentimentEngine` | String | `basic` (fast) or `enhanced` (deeper NLP) | enhanced |
| `language` | String | Comment language (ISO 639-1) | en |
| `minLikes` | Integer | Only analyze comments with ≥ this many likes | 0 |
| `proxyConfiguration` | Object | Proxy settings | Apify Proxy |

#### Example Input

```json
{
    "postUrls": [
        "https://www.instagram.com/p/ABC123/",
        "https://www.instagram.com/reel/XYZ789/"
    ],
    "maxComments": 50,
    "includeReplies": true,
    "sentimentEngine": "enhanced",
    "language": "en"
}
```

### Output

Each comment produces a structured JSON object:

```json
{
    "postUrl": "https://www.instagram.com/p/ABC123/",
    "postShortcode": "ABC123",
    "postOwner": "brandname",
    "postCaption": "Check out our new product! 🚀",
    "postLikes": 15420,
    "postCommentCount": 342,
    "commentId": "17890012345678",
    "commentText": "This is absolutely amazing! Love it 😍🔥",
    "commentAuthor": "user123",
    "commentLikes": 45,
    "commentTimestamp": "2024-01-15T14:30:00.000Z",
    "isReply": false,
    "parentCommentId": null,
    "sentimentScore": 8.25,
    "sentimentLabel": "very_positive",
    "sentimentComparative": 1.178,
    "positiveWords": ["amazing", "love"],
    "negativeWords": [],
    "emotionTags": ["joy", "trust"],
    "language": "en",
    "analyzedAt": "2024-01-16T10:00:00.000Z"
}
```

#### Sentiment Labels

| Label | Score Range | Meaning |
|-------|-----------|---------|
| `very_positive` | > 2 | Strong positive sentiment |
| `positive` | > 0 | Mild positive sentiment |
| `neutral` | 0 | No clear sentiment |
| `negative` | > -2 | Mild negative sentiment |
| `very_negative` | ≤ -2 | Strong negative sentiment |

#### Emotion Tags

The analyzer detects these emotions: `joy`, `anger`, `sadness`, `surprise`, `fear`, `disgust`, `trust`, `anticipation`

### Use Cases

- **Brand Monitoring**: Track how people feel about your brand mentions
- **Campaign Analysis**: Measure sentiment before/after a campaign launch
- **Influencer Vetting**: Analyze the quality and tone of an influencer's audience
- **Competitor Research**: Compare sentiment across competitor posts
- **Crisis Detection**: Spot negative sentiment spikes early
- **Product Feedback**: Extract customer opinions from product posts
- **Content Strategy**: Identify what content types generate the most positive reactions

### Pricing

This actor uses **pay-per-event** pricing:

- **$0.01 per comment analyzed**
- Example: Analyzing 100 comments = $1.00
- You only pay for what you use — no monthly fees

### Tips for Best Results

1. **Use residential proxies** for best success rates with Instagram
2. **Start with smaller batches** (50-100 comments) to test before scaling
3. **Use `enhanced` engine** for social media content — it understands slang and emojis
4. **Filter by likes** (`minLikes`) to focus on the most engaged comments
5. **Monitor rate limits** — the actor includes built-in delays to avoid Instagram blocks

### Limitations

- Only works with **public** Instagram posts (no private accounts)
- Instagram may rate-limit requests — the actor handles this with automatic retries
- Very old posts may have limited comment availability
- Sentiment analysis works best for English; other languages have basic support

### Support

Having issues? Check these common solutions:

1. **No comments returned**: Verify the post URL is correct and the account is public
2. **Timeout errors**: Reduce `maxComments` or try again later
3. **Proxy errors**: Use Apify residential proxies for best results

Built by [Growwstacks](https://growwstacks.com) — AI automation experts.

# Actor input Schema

## `postUrls` (type: `array`):

List of Instagram post URLs to scrape comments from. Supports /p/, /reel/, and /tv/ URLs.

## `maxComments` (type: `integer`):

Maximum number of comments to scrape per post. Set to 0 for all comments.

## `includeReplies` (type: `boolean`):

Whether to also scrape and analyze replies to top-level comments.

## `sentimentEngine` (type: `string`):

Choose the sentiment analysis method. 'basic' uses the Sentiment library (fast, free). 'enhanced' uses Natural NLP library for deeper analysis.

## `language` (type: `string`):

Primary language of comments for better sentiment accuracy. Use ISO 639-1 codes.

## `minLikes` (type: `integer`):

Only analyze comments with at least this many likes. Set to 0 to include all.

## `proxyConfiguration` (type: `object`):

Proxy settings for accessing Instagram. Apify Proxy is recommended.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.instagram.com/p/EXAMPLE/"
  ],
  "maxComments": 100,
  "includeReplies": false,
  "sentimentEngine": "enhanced",
  "language": "en",
  "minLikes": 0,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `analyzedComments` (type: `string`):

Instagram comments with sentiment analysis results including scores, labels, positive/negative words, and emotion tags.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "postUrls": [
        "https://www.instagram.com/p/EXAMPLE/"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("databuddy/instagram-comment-sentiment-analyzer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "postUrls": ["https://www.instagram.com/p/EXAMPLE/"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("databuddy/instagram-comment-sentiment-analyzer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "postUrls": [
    "https://www.instagram.com/p/EXAMPLE/"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call databuddy/instagram-comment-sentiment-analyzer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,databuddy/instagram-comment-sentiment-analyzer"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/cnCIHVBASSxgZJ1kO/builds/DSb2WwRU0WDIVgtYw/openapi.json
