# 🔍 Facebook Hashtag Search Scraper (`scrapapi/facebook-hashtag-search-scraper`) Actor

- **URL**: https://apify.com/scrapapi/facebook-hashtag-search-scraper.md
- **Developed by:** [ScrapAPI](https://apify.com/scrapapi) (community)
- **Categories:** Automation, Lead generation, Social media
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, NaN 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 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

## 🔍 Facebook Hashtag Search Scraper

**Scrape Facebook hashtag search results at scale — posts, reels, reactions, comments, shares, attachments and full Reels metadata.** Bulk hashtag input, automatic proxy fallback, and live streaming output. Built for marketers, growth teams, researchers and trend hunters.

---

### 🌟 Why Choose Us?

* ⚡ **Blazing fast** — async-first scraper with batched per-video enrichment.
* 🧱 **Production grade** — proxy fallback chain (`none → datacenter → residential`) keeps you collecting even when Facebook tightens up.
* 📡 **Live output** — every post lands in your dataset the moment it's scraped; a mid-run failure never costs you the data you already paid for.
* 🎬 **Rich Reels metadata** — Video posts are auto-enriched with full FB Shorts metadata (DRM info, muted segments, thumbnails, soundtracks, owners and more).
* 🏷️ **Bulk hashtags** — run dozens of hashtags in a single execution.
* 🎨 **Beautiful dataset view** — output table renders with labeled columns and emoji headers in the Apify Console.

---

### 🎯 Key Features

* 🔎 Hashtag and hashtag-URL input (mix and match)
* 📦 Per-hashtag max-post limit
* 🍪 Cookie-based authentication
* 🌐 Automatic proxy escalation if Facebook starts blocking
* 🎞️ Full Reels / FB Shorts metadata for video attachments
* ❤️ Reactions, comments, shares, views per post
* 🕒 Post timestamps and authors with avatars
* 💾 Live dataset streaming — every post pushed as soon as it's extracted

---

### 📥 Input

```json
{
  "searchQueries": ["football", "travel"],
  "maxItems": 50,
  "c_user": "YOUR_C_USER",
  "xs": "YOUR_XS_TOKEN",
  "proxyConfiguration": { "useApifyProxy": false }
}
````

| Field | Type | Description |
|-------|------|-------------|
| `searchQueries` | `string[]` | 🏷️ One or more hashtags (`football`) or hashtag URLs (`https://www.facebook.com/hashtag/football`). |
| `maxItems` | `integer` | 📦 Max posts to collect **per hashtag**. Default `50`. |
| `c_user` | `string` | 🍪 Your Facebook `c_user` cookie (numeric user ID). **Required.** |
| `xs` | `string` | 🍪 Your Facebook `xs` cookie (URL-encoded session token). **Required.** |
| `proxyConfiguration` | `object` | 🌐 Apify proxy config. Default = no proxy. The actor automatically falls back to **datacenter → residential** if Facebook starts blocking. |

***

### 📤 Output

Each pushed dataset record:

```json
{
  "searchQuery": "football",
  "postId": "1017535753998725",
  "user": {
    "name": "খেলাযোগ",
    "id": "100072269304011",
    "url": "https://www.facebook.com/profile.php?id=100072269304011",
    "avatar": "https://scontent.../profile.jpg"
  },
  "url": "https://www.facebook.com/1017535753998725",
  "text": "আর নয় অপেক্ষা…",
  "topReactions": { "Like": 269, "Love": 89, "Care": 14, "Haha": 3 },
  "commentsCount": 15,
  "sharesCount": 0,
  "videoViewCount": 1435,
  "time": "2026-05-14 13:30:39",
  "timestamp": 1778743839,
  "attachments": [
    {
      "deduplication_key": "",
      "target": { "__typename": "Video", "id": "2193122174769647" },
      "__typename": "StoryAttachment",
      "style_list": ["fb_shorts_creation", "video", "fallback"],
      "styles": { /* full Reels metadata */ },
      "media": { /* video media blob */ },
      "all_subattachments": { "nodes": [] }
    }
  ]
}
```

| Field | Description |
|-------|-------------|
| `searchQuery` | 🏷️ The hashtag that produced this post. |
| `postId` | 🆔 Facebook post ID. |
| `user` | 👤 Post author (name, id, profile url, avatar). |
| `url` | 🔗 Canonical post URL. |
| `text` | 📝 Post caption / message. |
| `topReactions` | ❤️ Reaction counts keyed by reaction name. |
| `commentsCount` / `sharesCount` | 💬🔁 Engagement counts. |
| `videoViewCount` | 👁️ Total video views (videos / Reels only). |
| `time` / `timestamp` | 🕒⏰ Post creation time (formatted + unix). |
| `attachments` | 📎 Full attachments array, including rich Reels metadata for videos. |

***

### 🚀 How to Use (Apify Console)

1. 🔐 Log in at **[console.apify.com](https://console.apify.com)** → **Actors**.
2. 🔎 Find **Facebook Hashtag Search Scraper** in your actor list and open it.
3. 🍪 Paste your Facebook cookies (use Cookie-Editor or EditThisCookie to export — at minimum `c_user` and `xs`).
4. 🏷️ Enter one or more hashtags or hashtag URLs.
5. 🌐 Leave proxy on **default (no proxy)** unless you specifically need one — the actor escalates automatically if needed.
6. ▶️ Click **Start**.
7. 📊 Watch logs stream live with engagement stats per scraped post.
8. 💾 Open the **Output** tab and export to JSON / CSV / XLSX.

***

### 🤖 Use via API / MCP

**Start a run:**

```bash
curl -X POST "https://api.apify.com/v2/acts/<ACTOR_ID>/runs?token=$APIFY_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "searchQueries": ["football"],
       "maxItems": 50,
       "cookies": [
         { "name": "c_user", "value": "..." },
         { "name": "xs", "value": "..." }
       ]
     }'
```

**Run and wait (sync) — get the dataset back immediately:**

```bash
curl -X POST "https://api.apify.com/v2/acts/<ACTOR_ID>/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"searchQueries":["travel"], "maxItems":20, "cookies":[...]}'
```

***

### 💡 Best Use Cases

- 📈 **Trend & topic research** — capture what people post under any hashtag right now.
- 🎯 **Audience analysis** — pull reaction / comment patterns for content benchmarking.
- 🧠 **Content ideation** — see what top-performing posts in your niche look like.
- 📰 **Real-time monitoring** — track breaking-topic hashtags and surface viral posts.
- 🎬 **Creator research** — pull full Reels metadata for short-form video studies.

***

### 💰 Pricing

This actor uses **pay-per-event** billing. You pay for:

| Event | Description |
|-------|-------------|
| **Actor start** | One-time platform start charge. |
| **Scraped post** | One charge per post written to the output dataset. |

Runs stop **cleanly** when your charge limit is reached — you keep everything scraped up to that point.

***

### ❓ Frequently Asked Questions

**Where do I get the cookies?**
Use a Chrome / Firefox cookie-export extension (Cookie-Editor, EditThisCookie). Open `facebook.com` while logged in, export cookies for the facebook.com domain, and paste them into the `cookies` input. Only `c_user` and `xs` are strictly required.

**Why do I need cookies at all?**
Facebook's hashtag search results are only returned to authenticated sessions. Without valid cookies the search endpoint returns no usable data.

**My run shows "switching to datacenter proxy" / "switching to residential proxy".**
That's the automatic fallback chain at work — Facebook blocked the direct request and the actor escalated. Output continues normally. You can also start at residential directly via the proxy input.

**Can I run multiple hashtags in one run?**
Yes — provide them all in `searchQueries`. Each hashtag is processed sequentially, with a clear log section per hashtag and live output to the same dataset.

**Will my data survive a crash?**
Yes. Every post is pushed to the dataset *the moment it's scraped*. A mid-run failure leaves a partial dataset, never an empty one.

***

### 🛟 Support & Feedback

🐞 Found a bug? Have a feature request? Open an issue on the actor's Apify page — we read every report.

***

### ⚖️ Legal & Compliance

- 📂 Only public hashtag-search results are collected.
- 🔒 Never scrape behind authentication you haven't been authorized to use.
- 🌐 You are responsible for complying with Facebook's Terms of Service, GDPR / CCPA, and any local data-protection laws applicable to your use case.

# Actor input Schema

## `searchQueries` (type: `array`):

🔎 Enter one or more **hashtags** (e.g. `football`, `travel`) or full Facebook hashtag URLs (e.g. `https://www.facebook.com/hashtag/football`). Both formats are accepted and bulk input is fully supported.

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

🎯 Maximum number of posts to scrape **per hashtag**. Higher = more data, longer runtime.

## `c_user` (type: `string`):

Your Facebook session cookie `c_user` (the numeric user ID). Copy it from your browser DevTools → Application → Cookies → www.facebook.com. Required to authenticate the scraper against Facebook's GraphQL API. 🔑

## `xs` (type: `string`):

Your Facebook session cookie `xs` (URL-encoded session token). Copy it from your browser DevTools → Application → Cookies → www.facebook.com. Keep it secret — it grants access to your account. 🔐

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

🛡️ By default the actor runs **without a proxy**. If Facebook rejects or rate-limits the request, the actor automatically falls back to a **datacenter proxy**, then to a **residential proxy** (with up to 3 retries). Once a fallback is engaged, the residential proxy stays in use for the rest of the run.

## Actor input object example

```json
{
  "searchQueries": [
    "football"
  ],
  "maxItems": 10,
  "proxyConfiguration": {
    "useApifyProxy": 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 = {
    "searchQueries": [
        "football"
    ],
    "c_user": "",
    "xs": "",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapapi/facebook-hashtag-search-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 = {
    "searchQueries": ["football"],
    "c_user": "",
    "xs": "",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("scrapapi/facebook-hashtag-search-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 '{
  "searchQueries": [
    "football"
  ],
  "c_user": "",
  "xs": "",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call scrapapi/facebook-hashtag-search-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "🔍 Facebook Hashtag Search Scraper",
        "description": null,
        "version": "0.1",
        "x-build-id": "Cld2aAFah0KKFCNso"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapapi~facebook-hashtag-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapapi-facebook-hashtag-search-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/scrapapi~facebook-hashtag-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-scrapapi-facebook-hashtag-search-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/scrapapi~facebook-hashtag-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-scrapapi-facebook-hashtag-search-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": [
                    "searchQueries",
                    "c_user",
                    "xs"
                ],
                "properties": {
                    "searchQueries": {
                        "title": "🏷️ Hashtags or Hashtag URLs (bulk supported)",
                        "type": "array",
                        "description": "🔎 Enter one or more **hashtags** (e.g. `football`, `travel`) or full Facebook hashtag URLs (e.g. `https://www.facebook.com/hashtag/football`). Both formats are accepted and bulk input is fully supported.",
                        "default": [
                            "football"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxItems": {
                        "title": "📦 Max Posts Per Hashtag",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "🎯 Maximum number of posts to scrape **per hashtag**. Higher = more data, longer runtime.",
                        "default": 10
                    },
                    "c_user": {
                        "title": "🍪 Facebook c_user Cookie",
                        "type": "string",
                        "description": "Your Facebook session cookie `c_user` (the numeric user ID). Copy it from your browser DevTools → Application → Cookies → www.facebook.com. Required to authenticate the scraper against Facebook's GraphQL API. 🔑"
                    },
                    "xs": {
                        "title": "🍪 Facebook xs Cookie",
                        "type": "string",
                        "description": "Your Facebook session cookie `xs` (URL-encoded session token). Copy it from your browser DevTools → Application → Cookies → www.facebook.com. Keep it secret — it grants access to your account. 🔐"
                    },
                    "proxyConfiguration": {
                        "title": "🌐 Proxy Configuration",
                        "type": "object",
                        "description": "🛡️ By default the actor runs **without a proxy**. If Facebook rejects or rate-limits the request, the actor automatically falls back to a **datacenter proxy**, then to a **residential proxy** (with up to 3 retries). Once a fallback is engaged, the residential proxy stays in use for the rest of the run.",
                        "default": {
                            "useApifyProxy": 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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
