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

Scrape Instagram posts by hashtag — works without login (12 fields). Login unlocks 30+ fields. Built-in residential proxy. Hashtag analytics, brand monitoring, UGC discovery.

- **URL**: https://apify.com/commanding\_hotdog/instagram-hashtag-scraper.md
- **Developed by:** [qingwa](https://apify.com/commanding_hotdog) (community)
- **Categories:** Social media, Marketing
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.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/platform/actors/running/actors-in-store#pay-per-event

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

Scrape Instagram posts from any hashtag — **no login required** for basic data, or add Instagram credentials to unlock 30+ rich fields.

### 🆓 No Login vs 🔑 With Login

| Feature | No Login | With Login |
|---------|----------|------------|
| Caption text | ✅ | ✅ |
| Hashtags & mentions | ✅ | ✅ |
| Post URL & shortcode | ✅ | ✅ |
| Author username | ✅ | ✅ |
| Media type | ✅ | ✅ |
| Image URL | ✅ | ✅ |
| Timestamp | ✅ | ✅ |
| Likes & comments | ❌ | ✅ |
| Video URL | ❌ | ✅ |
| Dimensions | ❌ | ✅ |
| Location (name, address) | ❌ | ✅ |
| Music info | ❌ | ✅ |
| Tagged users | ❌ | ✅ |
| Carousel details | ❌ | ✅ |
| Multiple resolutions | ❌ | ✅ |
| Comments text | ❌ | ✅ |
| Analytics | ❌ | ✅ |

**Just enter a hashtag and hit Start.** Add Instagram credentials only if you need the full dataset.

### Input

| Field | Required | Description |
|-------|----------|-------------|
| `hashtags` | ✅ | List of hashtags to scrape (without #) |
| `instagramUsername` | | 🔑 Optional — unlock 30+ fields |
| `instagramPassword` | | 🔑 Optional — password (stored encrypted) |
| `resultsLimit` | | Max posts per hashtag (default 50) |
| `resultsType` | | `top`, `recent`, `reels`, or `all` |
| `dateSince` / `dateUntil` | | Filter by date (login mode only) |
| `minLikes` / `minCommentsFilter` | | Engagement filters (login mode only) |
| `scrapeComments` | | Fetch top comments (login mode only) |

#### Example: No Login (basic data)
```json
{
  "hashtags": ["travel", "food"],
  "resultsLimit": 50,
  "resultsType": "top"
}
````

#### Example: With Login (full data)

```json
{
  "hashtags": ["travel", "food"],
  "instagramUsername": "your_username",
  "instagramPassword": "your_password",
  "resultsLimit": 100,
  "resultsType": "all",
  "minLikes": 100,
  "scrapeComments": true
}
```

### Output

Each post is one dataset item. No-login example:

```json
{
  "shortcode": "DZkOgM5zvkp",
  "url": "https://www.instagram.com/p/DZkOgM5zvkp/",
  "caption_text": "Beautiful sunset #travel #sunset",
  "hashtags": ["travel", "sunset"],
  "username": "traveler123",
  "media_type_name": "video",
  "product_type": "clips",
  "display_url": "https://...",
  "taken_at": "2026-06-14T12:19:18+00:00",
  "data_tier": "basic"
}
```

Login mode adds: `like_count`, `comment_count`, `view_count`, `video_url`, `width`, `height`, `location_name`, `music_title`, `tagged_users`, `carousel_media`, and more.

### Important Notes

- **Use a secondary Instagram account** if providing credentials. Automated logins carry ban risk.
- Without login, you get ~7-8 fields per post. With login, 30+ fields.
- Built-in residential proxy with automatic IP rotation.
- If `CHALLENGE_REQUIRED`: open Instagram app, complete verification, then retry.

### How It Works

**No Login:** Fetches hashtag page and post detail pages, extracts data from Instagram's embedded page content (RelayPrefetchedStreamCache).

**With Login:** Uses Instagram's mobile API via instagrapi for full data access — likes, comments, video URLs, location details, music info, and more.

Both modes use built-in residential proxies with automatic IP rotation for maximum reliability.

# Actor input Schema

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

Hashtags to scrape (without #). Most work without login. Some popular tags (#photography, #food, #fitness, #crypto, #anime, #beauty, #python) require Instagram credentials — add them below for guaranteed access.

## `instagramUsername` (type: `string`):

🔑 **Optional — add to unlock full data (30+ fields).** Without this, scraper still works but returns basic fields only (caption, media URL, author, timestamp). Your Instagram username (NOT email). Use a secondary account — automated logins carry ban risk.

## `instagramPassword` (type: `string`):

Password for the account above. Only needed if you want full data. Stored encrypted.

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

Maximum posts per hashtag. 0 = unlimited.

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

Which posts to scrape. top/recent/reels/all. Note: Without login, always returns top posts regardless of selection.

## `dateSince` (type: `string`):

Only scrape posts after this date (login mode only). Example: 2026-01-01

## `dateUntil` (type: `string`):

Only scrape posts before this date (login mode only). Example: 2026-06-01

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

Only include posts with at least this many likes (login mode only, 0 = no filter)

## `minCommentsFilter` (type: `integer`):

Only include posts with at least this many comments (login mode only, 0 = no filter)

## `scrapeComments` (type: `boolean`):

Fetch top comments per post (login mode only, slower)

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

Number of top comments per post (1-50, login mode only)

## `includeLocation` (type: `boolean`):

Location name, coordinates, address, city

## `includeMusic` (type: `boolean`):

Music title, artist, audio type for Reels

## `includeTaggedUsers` (type: `boolean`):

Users tagged in posts

## `includeCarouselMedia` (type: `boolean`):

Individual media from carousel posts

## `includeImageUrls` (type: `boolean`):

Image URLs in multiple resolutions

## `includeDimensions` (type: `boolean`):

Width and height of images/videos

## `includeRelatedHashtags` (type: `boolean`):

Extract related hashtags from Instagram

## `includeAnalytics` (type: `boolean`):

Total post count and metadata per hashtag

## Actor input object example

```json
{
  "hashtags": [
    "travel"
  ],
  "resultsLimit": 50,
  "resultsType": "top",
  "minLikes": 0,
  "minCommentsFilter": 0,
  "scrapeComments": false,
  "maxComments": 5,
  "includeLocation": true,
  "includeMusic": true,
  "includeTaggedUsers": true,
  "includeCarouselMedia": true,
  "includeImageUrls": true,
  "includeDimensions": true,
  "includeRelatedHashtags": false,
  "includeAnalytics": false
}
```

# 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": [
        "travel"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("commanding_hotdog/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": ["travel"] }

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

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Instagram Hashtag Scraper",
        "description": "Scrape Instagram posts by hashtag — works without login (12 fields). Login unlocks 30+ fields. Built-in residential proxy. Hashtag analytics, brand monitoring, UGC discovery.",
        "version": "2.0",
        "x-build-id": "2qEI3Qb6Jioed7lMZ"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/commanding_hotdog~instagram-hashtag-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-commanding_hotdog-instagram-hashtag-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/commanding_hotdog~instagram-hashtag-scraper/runs": {
            "post": {
                "operationId": "runs-sync-commanding_hotdog-instagram-hashtag-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/commanding_hotdog~instagram-hashtag-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-commanding_hotdog-instagram-hashtag-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",
                "required": [
                    "hashtags"
                ],
                "properties": {
                    "hashtags": {
                        "title": "Hashtags",
                        "type": "array",
                        "description": "Hashtags to scrape (without #). Most work without login. Some popular tags (#photography, #food, #fitness, #crypto, #anime, #beauty, #python) require Instagram credentials — add them below for guaranteed access.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "instagramUsername": {
                        "title": "Instagram Username (Optional)",
                        "type": "string",
                        "description": "🔑 **Optional — add to unlock full data (30+ fields).** Without this, scraper still works but returns basic fields only (caption, media URL, author, timestamp). Your Instagram username (NOT email). Use a secondary account — automated logins carry ban risk."
                    },
                    "instagramPassword": {
                        "title": "Instagram Password (Optional)",
                        "type": "string",
                        "description": "Password for the account above. Only needed if you want full data. Stored encrypted."
                    },
                    "resultsLimit": {
                        "title": "Max results per hashtag",
                        "minimum": 0,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum posts per hashtag. 0 = unlimited.",
                        "default": 50
                    },
                    "resultsType": {
                        "title": "Results type",
                        "enum": [
                            "top",
                            "recent",
                            "reels",
                            "all"
                        ],
                        "type": "string",
                        "description": "Which posts to scrape. top/recent/reels/all. Note: Without login, always returns top posts regardless of selection.",
                        "default": "top"
                    },
                    "dateSince": {
                        "title": "Date since (YYYY-MM-DD)",
                        "type": "string",
                        "description": "Only scrape posts after this date (login mode only). Example: 2026-01-01"
                    },
                    "dateUntil": {
                        "title": "Date until (YYYY-MM-DD)",
                        "type": "string",
                        "description": "Only scrape posts before this date (login mode only). Example: 2026-06-01"
                    },
                    "minLikes": {
                        "title": "Minimum likes",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only include posts with at least this many likes (login mode only, 0 = no filter)",
                        "default": 0
                    },
                    "minCommentsFilter": {
                        "title": "Minimum comments",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only include posts with at least this many comments (login mode only, 0 = no filter)",
                        "default": 0
                    },
                    "scrapeComments": {
                        "title": "Include comments (Login Mode Only)",
                        "type": "boolean",
                        "description": "Fetch top comments per post (login mode only, slower)",
                        "default": false
                    },
                    "maxComments": {
                        "title": "Max comments per post",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "Number of top comments per post (1-50, login mode only)",
                        "default": 5
                    },
                    "includeLocation": {
                        "title": "Include location (Login Mode Only)",
                        "type": "boolean",
                        "description": "Location name, coordinates, address, city",
                        "default": true
                    },
                    "includeMusic": {
                        "title": "Include music/audio (Login Mode Only)",
                        "type": "boolean",
                        "description": "Music title, artist, audio type for Reels",
                        "default": true
                    },
                    "includeTaggedUsers": {
                        "title": "Include tagged users (Login Mode Only)",
                        "type": "boolean",
                        "description": "Users tagged in posts",
                        "default": true
                    },
                    "includeCarouselMedia": {
                        "title": "Include carousel details (Login Mode Only)",
                        "type": "boolean",
                        "description": "Individual media from carousel posts",
                        "default": true
                    },
                    "includeImageUrls": {
                        "title": "Include image URLs (Login Mode Only)",
                        "type": "boolean",
                        "description": "Image URLs in multiple resolutions",
                        "default": true
                    },
                    "includeDimensions": {
                        "title": "Include media dimensions (Login Mode Only)",
                        "type": "boolean",
                        "description": "Width and height of images/videos",
                        "default": true
                    },
                    "includeRelatedHashtags": {
                        "title": "Include related hashtags (Login Mode Only)",
                        "type": "boolean",
                        "description": "Extract related hashtags from Instagram",
                        "default": false
                    },
                    "includeAnalytics": {
                        "title": "Include hashtag analytics (Login Mode Only)",
                        "type": "boolean",
                        "description": "Total post count and metadata per hashtag",
                        "default": false
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
