# Instagram Hashtag Scraper (`scrapeai/instagram-hashtag-scraper`) Actor

Scrape Instagram posts and reels by hashtags. Just add one or more hashtags and extract captions, locations, likes, plays, shares, comments count, images, timestamps, audio, and other hashtags. Export scraped hashtags, run the scraper via API, schedule and monitor runs or integrate with other tools.

- **URL**: https://apify.com/scrapeai/instagram-hashtag-scraper.md
- **Developed by:** [ScrapeAI](https://apify.com/scrapeai) (community)
- **Categories:** Social media, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## 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

## Instagram Hashtag Scraper

Extract Instagram posts and reels by one or more hashtags. Obtain captions, locations, likes, plays, shares, comments count, image URLs, video URLs, publishing timestamps, audio tracks, and extracted secondary hashtags.

### Features

- 🏷️ **Scrape by Hashtags**: Extract posts and reels matching single or multiple hashtags.
- 📝 **Rich Post Metadata**: Scrape post captions, extracted hashtags, publish dates, and shortcodes.
- 📊 **Engagement Statistics**: Extract likes count, comments count, video plays count, and estimated shares count.
- 🖼️ **Media & Carousels**: Download single images, multi-image carousel slides, and video URLs.
- 🎵 **Audio Tracks & Locations**: Extract audio title/artist for reels and geotag location data.
- ⚡ **Dynamic Dataset Outputs**: Outputs dataset items formatted dynamically based on your custom `input.json`.
- ⚙️ **API & Integration Ready**: Easily integrate with Webhooks, Zapier, Make, or run scheduled cloud automation on Apify.

### Input Parameters

| Parameter | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| `hashtags` | Array | Yes | `["photography", "nature"]` | List of Instagram hashtags to scrape (with or without `#`). |
| `resultsLimit` | Integer | No | `20` | Maximum number of posts/reels to extract per hashtag. |
| `resultsType` | String | No | `"top"` | Result sorting mode (`"top"`, `"recent"`, `"all"`). |
| `proxyConfiguration` | Object | No | - | Apify proxy configuration (residential proxies recommended). |
| `debugLog` | Boolean | No | `false` | Enable detailed debug log output. |

#### Example Input JSON

```json
{
  "hashtags": [
    "photography",
    "nature",
    "travel"
  ],
  "resultsLimit": 20,
  "resultsType": "top",
  "debugLog": false
}
```

### Output Data Structure

The scraper pushes structured JSON objects directly to your default Apify dataset.

#### Output Fields

- `id`: Unique Instagram post/reel ID.
- `type`: Content type (`"Post"`, `"Reel"`, or `"Sidecar"`).
- `shortCode`: Instagram post shortcode URL identifier.
- `url`: Direct canonical URL to the post or reel.
- `hashtag`: Target search hashtag.
- `caption`: Full caption text.
- `hashtags`: List of secondary hashtags extracted from caption text.
- `ownerId`: User ID of author.
- `ownerUsername`: Instagram handle of author.
- `ownerFullName`: Full name of author.
- `ownerIsVerified`: Verification badge status (`true`/`false`).
- `likesCount`: Total number of likes.
- `commentsCount`: Total number of comments.
- `playsCount`: Video play count (for reels).
- `sharesCount`: Estimated shares count.
- `displayUrl`: Main preview image URL.
- `images`: Array of image URLs (supports carousel slides).
- `videoUrl`: Direct video URL (for reels).
- `audio`: Audio track object (`id`, `title`, `artist`).
- `location`: Geotag location details (`id`, `name`, `city`).
- `timestamp`: ISO 8601 creation timestamp.
- `scrapedAt`: ISO 8601 scraping timestamp.

#### Example Output Item JSON

```json
{
  "id": "318182992011",
  "type": "Reel",
  "shortCode": "C3x9Z1yL8kM",
  "url": "https://www.instagram.com/reel/C3x9Z1yL8kM/",
  "hashtag": "photography",
  "caption": "Capturing the essence of #photography! Exploring amazing places and creating memories. #photooftheday #naturephotography",
  "hashtags": [
    "#photography",
    "#photooftheday",
    "#naturephotography"
  ],
  "ownerId": "user_4912",
  "ownerUsername": "photography_creator_4912",
  "ownerFullName": "Photography Explorer 4912",
  "ownerIsVerified": false,
  "likesCount": 24500,
  "commentsCount": 812,
  "playsCount": 184000,
  "sharesCount": 340,
  "displayUrl": "https://instagram.fcdn.net/v/t51.2885-15/photography_C3x9Z1yL8kM.jpg",
  "images": [
    "https://instagram.fcdn.net/v/t51.2885-15/photography_C3x9Z1yL8kM.jpg"
  ],
  "videoUrl": "https://instagram.fcdn.net/v/t51.2885-15/photography_C3x9Z1yL8kM.mp4",
  "audio": {
    "id": "audio_801",
    "title": "Original Audio - photography_creator",
    "artist": "photography_creator"
  },
  "location": {
    "id": "loc_101",
    "name": "Yosemite National Park",
    "city": "California"
  },
  "timestamp": "2026-08-06T11:00:00.000Z",
  "scrapedAt": "2026-08-06T15:00:00.000Z"
}
```

### How to Run

#### Via Apify Console

1. Open the Actor on [Apify Console](https://console.apify.com/).
2. Enter desired hashtags in the input form.
3. Click **Start** and view or download output datasets in JSON, CSV, Excel, or HTML table format.

#### Via Apify API

```bash
curl -X POST "https://api.apify.com/v2/acts/instagram-hashtag-scraper/runs?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "hashtags": ["photography", "nature"],
    "resultsLimit": 20
  }'
```

### Exporting & Integrations

Export scraped dataset outputs seamlessly to Google Drive, AWS S3, Keboola, Snowflake, or receive real-time updates using Apify Webhooks.

# Actor input Schema

## `hashtags` (type: `array`):

List of Instagram hashtags to scrape (e.g. \['photography', 'nature', 'travel'] or \['#photography', '#nature']).

## `resultsLimit` (type: `integer`):

Maximum number of posts and reels to extract per hashtag.

## `resultsType` (type: `string`):

Specify whether to fetch top posts, recent posts, or all available posts.

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

Select proxies to be used by your crawler. Residential proxies are recommended for Instagram.

## `debugLog` (type: `boolean`):

Enable verbose debug logging.

## Actor input object example

```json
{
  "hashtags": [
    "photography",
    "nature",
    "travel"
  ],
  "resultsLimit": 20,
  "resultsType": "top",
  "debugLog": false
}
```

# Actor output Schema

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

Dataset containing scraped Instagram hashtag posts.

# 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 = {
    "hashtags": [
        "photography",
        "nature",
        "travel"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapeai/instagram-hashtag-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 = { "hashtags": [
        "photography",
        "nature",
        "travel",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("scrapeai/instagram-hashtag-scraper").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 '{
  "hashtags": [
    "photography",
    "nature",
    "travel"
  ]
}' |
apify call scrapeai/instagram-hashtag-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapeai/instagram-hashtag-scraper"
        }
    }
}

```

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/7cmrV3zmYI9H207lJ/builds/NuSkQy7L5HL7cxpE4/openapi.json
