# Facebook Hashtag Scraper (`neuro-scraper/facebook-hashtag-scraper`) Actor

Facebook Hashtag Scraper SD - Facebook Hashtag Scraper is a social media data tool that extracts public Facebook posts for any #hashtag: text, author, date, reactions by type, comments and shares counts, photos and videos, top or recent, page after page, no login.

- **URL**: https://apify.com/neuro-scraper/facebook-hashtag-scraper.md
- **Developed by:** [Neuro Scraper](https://apify.com/neuro-scraper) (community)
- **Categories:** Social media, Automation
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.49 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

### Facebook Hashtag Scraper - public posts for any #hashtag

Facebook Hashtag Scraper collects the public Facebook posts that Facebook shows for a hashtag
(`facebook.com/hashtag/<tag>`), without logging in. For every post you get the text, author, date,
reactions (total and per type), comments and shares counts, photos, videos and links - page after
page, from the Top tab or the Recent tab. Export the dataset as JSON, CSV or Excel, or use the Apify
API, webhooks, Make, Zapier or n8n integrations.

#### How it works

Facebook's hashtag page preloads its own posts query together with the session values. The Actor
reads the query id, its variables and the cursor from that page on every run (nothing is hardcoded)
and asks the same query for the next page with the cursor. Comments are read with Facebook's comment
queries, whose ids come from a post page's JavaScript bundles each run.

#### Input

| Field | What it does |
|---|---|
| `hashtags` | Hashtags with or without `#`, or `facebook.com/hashtag/...` URLs, one per line |
| `maxItems` | Max posts per hashtag (default 20) |
| `sortBy` | `top` (Top posts) or `recent` (Recent posts) - Facebook's two hashtag tabs |
| `onlyPostsNewerThan` / `onlyPostsOlderThan` | Date window: `2026-09-01`, an ISO time, or `7 days`, `3 months`, `1 year` |
| `postTypes` | Keep only `photo`, `video`, `reel`, `text`, `link`, `share` |
| `keywords` | Keep only posts whose text contains any of these words |
| `maxComments`, `commentsSort`, `maxRepliesPerComment` | Attach public comments (and replies) to every post |
| `onlyNewPosts` | Skip posts delivered in earlier runs (monitoring) |
| `includeRaw` | Add Facebook's complete post object as `raw` |
| `maxPagesPerHashtag`, `maxTotalItems`, `proxyConfiguration` | Safety limits and proxy (RESIDENTIAL by default) |

#### Output (one row per post)

| Field | Meaning |
|---|---|
| `postId`, `storyId`, `feedbackId`, `url` | Post ids and permalink |
| `text`, `hashtags`, `mentions`, `links` | Post text and the entities in it |
| `time`, `timestamp` | Publication time (ISO UTC and Unix seconds) |
| `postFormat` | photo, video, reel, text, link or share |
| `authorName`, `authorId`, `authorUrl`, `authorType`, `authorProfilePictureUrl` | Who posted |
| `reactionsCount`, `reactionLikeCount` ... `reactionAngryCount` | Reactions, total and by type |
| `commentsCount`, `sharesCount`, `viewsCount` | Engagement counts (views for videos) |
| `media`, `imageUrls`, `videoUrls` | Photos (full size, alt text) and videos (MP4 link, thumbnail, duration) |
| `linkUrl`, `linkTitle`, `linkDescription`, `linkSource` | Shared outside link |
| `groupId`, `groupName`, `groupUrl` | When the post was made in a public group |
| `comments`, `commentsScraped` | With `maxComments` > 0 |
| `hashtag`, `inputHashtag`, `sortBy`, `position`, `scrapedAt` | Run context |

#### Measured limits (local runs, 2026-10-03, see TEST_REPORT.md)

- Facebook shows a limited set per hashtag and tab logged out: #travel 88 posts (Top) / 87 (Recent),
  \#nasa 62 (Top), then the cursor ends. Run both tabs for more unique posts.
- About 5-6 posts per page request; 60 posts took 36-40 s (13 pages).
- The results are Facebook's own selection and change between runs; no total post count is shown.
- Comments: about 10 per request; the comment count includes replies.

#### Example

```json
{"hashtags": ["travel", "#foodie"], "maxItems": 50, "sortBy": "recent", "onlyPostsNewerThan": "30 days"}
```

# Actor input Schema

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

Hashtags with or without # (travel, #travel) or facebook.com/hashtag/... URLs, one per line. Letters and digits only - a space ends a hashtag.

## `maxItems` (type: `integer`):

Facebook shows about 60-90 public posts per hashtag and tab logged out (measured).

## `sortBy` (type: `string`):

Facebook's own two hashtag tabs (Top / Recent). Run both for more unique posts.

## `onlyPostsNewerThan` (type: `string`):

Keep posts published on or after this date: 2026-09-01, a full ISO time, or a relative period such as "7 days", "2 weeks", "3 months", "1 year". Empty = no limit.

## `onlyPostsOlderThan` (type: `string`):

Keep posts published on or before this date (same formats). Empty = no limit.

## `postTypes` (type: `array`):

Keep only these formats: photo, video, reel, text, link, share (one per line). Empty = all.

## `keywords` (type: `array`):

Keep only posts whose text contains any of these words or phrases (one per line, case-insensitive).

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

Also read up to this many public comments of every post and attach them as "comments". Each comment page is one extra request (about 10 comments per request).

## `commentsSort` (type: `string`):

Order of the comments Facebook returns.

## `maxRepliesPerComment` (type: `integer`):

Also read replies of each comment (nested under "replies").

## `onlyNewPosts` (type: `boolean`):

Remember delivered post ids (named key-value store "facebook-hashtag-scraper-state") and skip them in later runs - for monitoring a hashtag.

## `includeRaw` (type: `boolean`):

Adds the complete post object Facebook returned as "raw" (large).

## `maxPagesPerHashtag` (type: `integer`):

Safety stop. About 5-6 posts arrive per page.

## `maxTotalItems` (type: `integer`):

Stops the whole run after this many dataset rows (all inputs together).

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

Facebook limits logged-out visitors per IP address. Residential proxies (the default) give the most reliable results; the Actor switches to a fresh IP when Facebook refuses one.

## Actor input object example

```json
{
  "hashtags": [
    "travel"
  ],
  "maxItems": 20,
  "sortBy": "top",
  "maxComments": 0,
  "commentsSort": "relevant",
  "maxRepliesPerComment": 0,
  "onlyNewPosts": false,
  "includeRaw": false,
  "maxPagesPerHashtag": 60,
  "maxTotalItems": 0,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("neuro-scraper/facebook-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"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("neuro-scraper/facebook-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": [
    "travel"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call neuro-scraper/facebook-hashtag-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,neuro-scraper/facebook-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/T51pHMt06akUolY1A/builds/b7PZyYTaJdLxSdlbM/openapi.json
