# Instagram Posts Scraper (`powerful_bachelor/instagram-posts-scraper`) Actor

Easily scrape public Instagram posts with Instagram Posts Scraper! Extract data for market research, sentiment analysis, and more. Download in formats like CSV, JSON, and Excel. Ideal for gaining valuable insights and enhancing your marketing strategy. 📸🚀

- **URL**: https://apify.com/powerful\_bachelor/instagram-posts-scraper.md
- **Developed by:** [Powerful Bachelor](https://apify.com/powerful_bachelor) (community)
- **Categories:** Social media
- **Stats:** 141 total users, 1 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: 1.00 out of 5 stars

## Pricing

$30.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## 📸 Instagram Posts Scraper

Instagram Posts Scraper allows you to scrape public posts from any Instagram user. Just enter one or more Instagram usernames and you can extract and download all their posts in Excel, HTML, XML, CSV, or JSON to use in reports, data visualizations, spreadsheets, and other applications.

### 🤔 Why scrape Instagram posts?

Instagram post data can provide valuable insights for:

- 📊 Improving market research
- 🎯 Optimizing your marketing and PR
- 💬 Conducting sentiment analysis
- 📈 Understanding audience engagement
- 🤖 Training your AI models
- 📰 Monitoring fake news

### 🚀 Main Features

Instagram Posts Scraper is packed with powerful features to help you extract valuable Instagram Posts data:

- **Post Caption**: Extract detailed captions from each post.
- **Video URL**: Retrieve URLs for any video content included in the posts.
- **Comments Count**: Get the number of comments for each post.
- **Like Count**: See how many likes each post has received.
- **Video View Count**: View count metrics for video posts.
- **Post Date**: The date when the post was published.
- **Is Paid Partnership**: Identify posts that are part of paid partnerships, essential for marketers to analyze sponsored content.
- **Is Affiliate**: Determine if posts are affiliated, helping marketers track and evaluate affiliate marketing efforts.

### 🛠️ How to scrape Instagram posts

Instagram Posts Scraper is designed to be fast and easy to use, with minimal parameters or settings. Just follow these steps:

1. 🔑 Create a free Apify account.
2. 🔍 Open Instagram Posts Scraper.
3. ✏️ Add one or more Instagram usernames to scrape.
4. 🚀 Click "Save & Start" and wait for the datasets to be extracted.
5. 💾 Download your data in JSON, XML, CSV, Excel, or HTML.

### 📈 How many results can you scrape with Instagram Posts Scraper?

Instagram Posts Scraper can return thousands of results on average, depending on the number of posts available and other factors. The best way to know for sure for your particular use case is to run a test scrape.

### ⚖️ Is it legal to scrape personal data?

Our Instagram scrapers are ethical and do not extract any private user data, such as email addresses, gender, or location. They only extract what the user has chosen to share publicly. However, be aware that your results could contain personal data protected by regulations like GDPR. Do not scrape personal data unless you have a legitimate reason.

### 📝 Input parameters

There are just two fields to fill out: an Instagram username (one or multiple) and the number of results you'd like to receive.

#### Example input:

```json
{
  "usernames": ["google"],
  "maxResults": 15
}
````

### Output example

Each item will be a separate entry in the dataset. You can view the extracted data as an overview table or see all fields in different formats. Export them from the platform onto your computer or integrate with other apps directly.

```json
{
"user_id": "1067259270",
"post_id": "3368012288618763443",
"short_code": "C69lVT-RZSz",
"typename": "GraphImage",
"is_paid_partnership": false,
"is_affiliate": false,
"likes_count": 15951,
"comment_count": 1331,
"video_view_count": 0,
"post_date": "2024-05-14T20:26:13.000Z",
"is_video": false,
"has_audio": false,
"display_url": "https://scontent-atl3-2.cdninstagram.com/v/t51.29350-15/436566132_754771200111026_8495874532985308359_n.jpg?stp=dst-jpg_e15_fr_p1080x1080&_nc_ht=scontent-atl3-2.cdninstagram.com&_nc_cat=102&_nc_ohc=L5bFcJ1i1GgQ7kNvgFHK8b6&edm=AOQ1c0wBAAAA&ccb=7-5&oh=00_AYBfg7a3T1pStIL1VLydHFBLkNvsb0IK--TJKw8-kz6QPQ&oe=666A07DF&_nc_sid=8b3546",
"thumbnail_src": "https://scontent-atl3-2.cdninstagram.com/v/t51.29350-15/436566132_754771200111026_8495874532985308359_n.jpg?stp=c0.135.1080.1080a_dst-jpg_e35_s640x640_sh0.08&_nc_ht=scontent-atl3-2.cdninstagram.com&_nc_cat=102&_nc_ohc=L5bFcJ1i1GgQ7kNvgFHK8b6&edm=AOQ1c0wBAAAA&ccb=7-5&oh=00_AYCYPScRasYUiub0dd1qkAXjgVX2dVgCwtgo3bco5-Sh2w&oe=666A07DF&_nc_sid=8b3546",
"accessibility_caption": "A photo of Sundar Pichai on the I/O main stage at Shoreline. Text underneath says \"Google I/O 2024: An I/O for a new generation #GoogleIO.\"",
"caption": "“We’ve been AI-first in our approach for a long time. Our decades of research leadership have pioneered many of the modern breakthroughs that power AI progress, for us and for the industry. On top of that we have:\n\nWorld-leading infrastructure built for the AI era \nCutting-edge innovation in Search, now powered by Gemini\nProducts that help at extraordinary scale — including 15 products with half a billion users\nAnd platforms that enable everyone — partners, customers, creators — and all of you — to invent the future. \n\nThis progress is only possible because of our incredible developer community. You are making it real, through the experiences and applications you build every day. So, to everyone here in Shoreline and the millions more watching around the world, here’s to the possibilities ahead and creating them together.” - @sundarpichai\n\nRead Sundar’s remarks from #GoogleIO at the link in bio.",
"video_url": "",
"audio_info": {},
"child_posts": null,
"owner": {
"id": "1067259270",
"username": "google"
},
"coauthor_producer": [],
"tagged_users": [
{
"node": {
"user": {
"full_name": "Sundar Pichai",
"followed_by_viewer": false,
"id": "857021616",
"is_verified": true,
"profile_pic_url": "https://scontent-atl3-1.cdninstagram.com/v/t51.2885-19/18444526_1939440572957195_3903952120457461760_a.jpg?stp=dst-jpg_s150x150&_nc_ht=scontent-atl3-1.cdninstagram.com&_nc_cat=1&_nc_ohc=Oueqvp2Rtl0Q7kNvgHVMQzd&edm=AOQ1c0wBAAAA&ccb=7-5&oh=00_AYAXMafZQzoSkEg-hWYs9NTyoDInuAnTD-u06dRQliFXNw&oe=666A14F9&_nc_sid=8b3546",
"username": "sundarpichai"
},
"x": 0.7412868633,
"y": 0.44325481800000005
}
}
]
}...

```

### 🚀 Transform Your Data Insights

Instagram Posts Scraper is a powerful tool for extracting valuable Instagram posts data. Whether you need insights for market research, sentiment analysis, or audience engagement, this scraper provides a straightforward and efficient solution. If you have any feedback or encounter any issues, please reach out through the Actor’s Issues tab in Apify Console. Happy scraping!🎉

# Actor input Schema

## `usernames` (type: `array`):

Enter the Instagram usernames of the accounts you want to scrape.

## `maxResults` (type: `integer`):

Specify the maximum number of posts to scrape from each username. If not specified, the default is 15 posts..

## Actor input object example

```json
{
  "usernames": [
    "google",
    "dell"
  ],
  "maxResults": 15
}
```

# 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 = {
    "usernames": [
        "google",
        "dell"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("powerful_bachelor/instagram-posts-scraper").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 = { "usernames": [
        "google",
        "dell",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("powerful_bachelor/instagram-posts-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "usernames": [
    "google",
    "dell"
  ]
}' |
apify call powerful_bachelor/instagram-posts-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=powerful_bachelor/instagram-posts-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Instagram Posts Scraper",
        "description": "Easily scrape public Instagram posts with Instagram Posts Scraper! Extract data for market research, sentiment analysis, and more. Download in formats like CSV, JSON, and Excel. Ideal for gaining valuable insights and enhancing your marketing strategy. 📸🚀",
        "version": "0.0",
        "x-build-id": "a3UU0TwJMUJ5Ckteb"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/powerful_bachelor~instagram-posts-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-powerful_bachelor-instagram-posts-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/powerful_bachelor~instagram-posts-scraper/runs": {
            "post": {
                "operationId": "runs-sync-powerful_bachelor-instagram-posts-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/powerful_bachelor~instagram-posts-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-powerful_bachelor-instagram-posts-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "usernames": {
                        "title": "Instagram Usernames",
                        "type": "array",
                        "description": "Enter the Instagram usernames of the accounts you want to scrape.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxResults": {
                        "title": "Number of Posts",
                        "maximum": 3000,
                        "type": "integer",
                        "description": "Specify the maximum number of posts to scrape from each username. If not specified, the default is 15 posts..",
                        "default": 15
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
