# Instagram Reels Scraper (`hpix/ig-reels-scraper`) Actor

Scrape Instagram Reels, Profiles and Posts efficiently and reliably.

- **URL**: https://apify.com/hpix/ig-reels-scraper.md
- **Developed by:** [Hpix](https://apify.com/hpix) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 1,978 total users, 41 monthly users, 100.0% runs succeeded, 100 bookmarks
- **User rating**: 4.81 out of 5 stars

## Pricing

$20.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 web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

### ℹ️ About

An efficient and straightforward Actor for scraping Instagram posts, profiles, and Reels, designed with performance in mind.

### ✨ Features

- Retrieve **profile stats** such as followers, bio, username, and links.
- Scrape reels, including **likes, play counts, comments**, captions, and music metadata.
- Choose the number of reels to scrape per profile.
- Scrape thousands of profiles and posts seamlessly.

### ⚙️ Inputs

- **profiles**: A list of Instagram usernames or URLs to scrape.
- **reels\_count**: Define the target number of reels/posts to fetch per profile (default: `12`).
- **target**: Choose what to scrape:
  - `all` — Profiles and reels
  - `all_with_posts` — Profiles, reels, and posts
  - `profiles_only` — Profiles only
  - `reels_only` — Reels only
  - `posts_only` — Posts only
  - `reels_and_posts_only` — Reels and posts (skips profile data)
- **post\_urls**: Scrape individual Instagram posts or reels using their URL or shortcode.
- **skip\_pinned**: When `true`, pinned posts/reels are excluded from results (default: `false`).
- **beginDate**: Only scrape posts/reels created after this date. Supports absolute (`YYYY-MM-DD`) and relative (`7 days`, `2 weeks`, `1 month`, `1 year`) formats.
- **endDate**: Only scrape posts/reels created before this date. Supports the same formats as `beginDate`.
- **include\_raw\_data**: Include raw data collected from Instagram in the final results. Disable to reduce dataset size (default: `true`).
- **maxConcurrency**: Maximum number of concurrent requests. Use this to control load and avoid blocks (default: `200`, min: `1`, max: `1000`).
- **proxyConfiguration**: Proxy settings for requests. Defaults to Apify Residential proxy for better reliability.

#### Example:

This input will scrape `zuck`'s profile, 8 of the latest reels from his feed, and one post with the code `DFNkPgRROOS`:

```json
{
  "profiles": [
    "zuck"
  ],
  "target": "all",
  "reels_count": 8,
  "post_urls": [
    "https://www.instagram.com/p/DFNkPgRROOS"
  ],
  "include_raw_data": true,
  "custom_functions": "{ shouldSkip: (data) => false, shouldContinue: (data) => true }"
}
```

#### Custom functions

This is an advanced parameter that you can use to modify the crawler's behavior.
With custom functions, you can skip a post or profile based on its data or stop crawling a profile's reels when a certain condition is met.

For example, you can skip posts if they don't have music metadata:

```javascript
{
  shouldSkip: (data) => data.kind == 'post' && !data.music_metadata
}
```

Or stop crawling when it reaches the shortcode of a post:

```javascript
{
  shouldContinue: (data) => data.code != 'codeToStopCrawling'
}
```

The `data` argument is the same of an item on the final dataset (see Outputs).

#### Tips

- The actor is optimized for bulk scraping. Running it with multiple profiles simultaneously is significantly faster than processing one profile at a time.
- To optimize costs, this actor is memory-efficient and can run smoothly with just 256MB to 512MB of memory allocated.

### 📄 Outputs

#### Profile

```json
{
	"kind": "profile",
	"input": "zuck",
	"id": "314216",
	"is_private": false,
	"username": "zuck",
	"full_name": "Mark Zuckerberg",
	"biography": "",
	"bio_links": [],
	"followers": 15534658,
	"following": 610,
	"profile_pic": "https://scontent-lga3-1.cdninstagram.com/...",
	"profile_url": "https://www.instagram.com/zuck/",
	"raw_data": {...}
}
```

#### Reel

```json
{
	"kind": "post",
	"id": "3548364142010150900_314216",
	"code": "DE-UmMaP6_0",
	"post_type": "reel",
	"post_url": "https://www.instagram.com/p/DE-UmMaP6_0",
	"owner_id": "314216",
	"is_pinned": false,
	"taken_at": 1737218208,
	"taken_at_formatted": "2025-01-18T12:36:48.000Z",
	"caption": "Send it",
	"hashtags": [],
	"play_count": 4456434,
	"comment_count": 7776,
	"like_count": 134906,
	"has_privately_liked": false,
	"thumbnail_url": "https://instagram.fagc3-2.fna.fbcdn.net/...",
	"video_url": "https://scontent-iad3-1.cdninstagram.com/...",
	"duration": 19.945,
	"music_metadata": {...},
	"video_versions": [
		{
			"height": 852,
			"type": 101,
			"url": "https://scontent-iad3-1.cdninstagram.com/...",
			"width": 480
		},
		{
			"height": 852,
			"type": 103,
			"url": "https://scontent-iad3-1.cdninstagram.com/...",
			"width": 480
		},
		{
			"height": 852,
			"type": 102,
			"url": "https://scontent-iad3-1.cdninstagram.com/...",
			"width": 480
		}
	],
	"raw_data": {...}
}
```

#### Post

```json
{
	"kind": "post",
	"input": "DFNkPgRROOS",
	"id": "3552655076181205906",
	"code": "DFNkPgRROOS",
	"post_type": "post",
	"post_url": "https://www.instagram.com/p/DFNkPgRROOS",
	"owner_id": "314216",
	"is_pinned": false,
	"taken_at": 1737730421,
	"taken_at_formatted": "2025-01-24T14:53:41.000Z",
	"caption": "Grateful to train with you @marcelogarciajiujitsu. Good luck and have fun vs Imanari today!",
	"hashtags": [],
	"like_count": 249896,
	"comment_count": 4627,
	"thumbnail_url": "https://scontent-lga3-2.cdninstagram.com/...",
	"image_url": "https://scontent-lga3-2.cdninstagram.com/...",
	"raw_data": {..}
}
```

> **Note:** If scraping fails for an item (e.g., private/restricted account or deleted post), the output will include an `error` field describing the issue instead of the regular data.

### 📃 Changelog

Do you have a feature suggestion?
Create an [issue](https://console.apify.com/actors/PE8EVAh0QG4mH6cLP/issues) and let me know!

#### v1.2.0

- ✨ Added support to scrape all the posts (including Reels) of a profile
- ✨ Added more fields to the output dataset
- 🔧 Fixed date range filtering for pinned posts

#### v1.1.0

- ✨ Added proxy settings
- ✨ Added date range filtering for scraping reels
- ✨ Added configurable maximum concurrency limit for scraping requests
- ✨ Added an option to skip pinned reels
- 🔧 Fixed timeout issues during scraping
- 🔧 Improved handling of restricted Instagram accounts
- ⚡ Optimized concurrency and memory usage

#### v1.0.0

- ✨ Added support for scraping individual Reels and posts via URL or code
- ✨ Introduced new `include_raw_data` option to control raw data inclusion in results
- ✨ Added custom JavaScript functions for post/profile filtering and crawl control
- ✨ Added support for Instagram profile URLs as input
- ⚡ Optimized crawler performance for faster scraping
- 🔧 Enhanced logging functionality

#### v0.1

- Initial release

### ❓ FAQ

#### Can I export the scraped data to Excel?

Sure! Apify allows you to download the results as an Excel spreadsheet.
You can also download in CSV, JSON, XML, HTML, JSONL, and RSS.

#### I just found a bug! Can you fix it?

Oh, what a shame! Please create an [Issue](https://console.apify.com/actors/UZtg5u1o4SeZh3Kn6/issues), so I can evaluate what happened.

#### Can you implement X feature?

Of course! You can use the **[Issues](https://console.apify.com/actors/UZtg5u1o4SeZh3Kn6/issues)** tab to suggest new features.

### ⚠️ Disclaimer

This Actor scrapes public data from Instagram pages. Features are susceptible to changes made by Meta.

### ⛓️‍💥 Known issues

- Currently, it is not possible to scrape private or age-restricted accounts, since those are not public.

### 👀 See also

- [Instagram Profile Monitor](https://apify.com/hpix/instagram-profile-monitor): Track Instagram profiles over time and monitor growth trends with historical data analysis and beautiful visualizations. Perfect for tracking competitors, influencers, or your own profile's performance.

# Actor input Schema

## `profiles` (type: `array`):

Instagram usernames or URLs to fetch content from.

## `target` (type: `string`):

Select what will be scraped from the profiles.

## `reels_count` (type: `integer`):

Number of posts/reels to scrape per profile.

## `fetch_reels_data` (type: `boolean`):

When enabled, extra metadata (play count, view count, music info, duration) is fetched for each reel. This is most useful when scraping posts and reels together and requires more proxy bandwidth.

## `skip_pinned` (type: `boolean`):

Don't scrape pinned posts

## `post_urls` (type: `array`):

Scrape posts using their URL or short code

## `beginDate` (type: `string`):

Only scrape posts created after this date

## `endDate` (type: `string`):

Only scrape posts created before this date

## `include_raw_data` (type: `boolean`):

Include raw data collected from Instagram in the final results. Disable this to reduce the final dataset size.

## `importantProperties` (type: `array`):

The scraper will try its best to scrape these properties. If these are not important for you, you can disable them to save proxy bandwidth.

## `maxConcurrency` (type: `integer`):

Maximum number of concurrent requests to make. Use this to control the load on Instagram's servers and avoid getting blocked.

## `custom_functions` (type: `string`):

Functions to customize the crawler's behaviour. Accepts an object with two functions, `shouldSkip` and `shouldContinue`, each taking a data argument which contains the data for the current scraped item.

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

Proxy configuration to use for requests. Residential proxies are recommended for better performance and reliability.

## Actor input object example

```json
{
  "profiles": [
    "zuck"
  ],
  "target": "all",
  "reels_count": 12,
  "fetch_reels_data": false,
  "skip_pinned": false,
  "include_raw_data": true,
  "importantProperties": [
    "media_count",
    "related_profiles"
  ],
  "maxConcurrency": 200,
  "custom_functions": "{ shouldSkip: (data) => data.kind == 'post' && !data.music_metadata, shouldContinue: (data) => data.code != 'codeToStopCrawling' }",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

# 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 = {
    "profiles": [
        "zuck"
    ],
    "target": "all",
    "importantProperties": [
        "media_count",
        "related_profiles"
    ],
    "custom_functions": "{ shouldSkip: (data) => false, shouldContinue: (data) => true }"
};

// Run the Actor and wait for it to finish
const run = await client.actor("hpix/ig-reels-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 = {
    "profiles": ["zuck"],
    "target": "all",
    "importantProperties": [
        "media_count",
        "related_profiles",
    ],
    "custom_functions": "{ shouldSkip: (data) => false, shouldContinue: (data) => true }",
}

# Run the Actor and wait for it to finish
run = client.actor("hpix/ig-reels-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 '{
  "profiles": [
    "zuck"
  ],
  "target": "all",
  "importantProperties": [
    "media_count",
    "related_profiles"
  ],
  "custom_functions": "{ shouldSkip: (data) => false, shouldContinue: (data) => true }"
}' |
apify call hpix/ig-reels-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/PE8EVAh0QG4mH6cLP/builds/FtI8y9vj0ohOfwKtr/openapi.json
