# Facebook Search Scraper (`khadinakbar/facebook-search-scraper`) Actor

Search Facebook by keyword across Events, Marketplace, and the Ad Library (ads + advertisers) in one actor. Cookieless, no login. Provider-backed, MCP-ready.

- **URL**: https://apify.com/khadinakbar/facebook-search-scraper.md
- **Developed by:** [Khadin Akbar](https://apify.com/khadinakbar) (community)
- **Categories:** Social media, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 result founds

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

## Facebook Search Scraper

Search Facebook by keyword across **Events**, **Marketplace**, and the **Ad Library** (ads + advertisers) — from a single actor, with no login and no cookies. Pass one keyword, pick a `searchType`, and get back clean, flat, structured JSON. Built for marketers, competitor researchers, deal hunters, event promoters, and AI agents.

### What it does

Facebook only lets you keyword-search a few surfaces **without logging in**. This actor covers all four of them and normalizes them into one consistent output shape:

| `searchType` | What you get | Powered by |
|---|---|---|
| `ads` | Live/inactive **Ad Library** creatives matching your keyword — ad copy, CTA, landing URL, images, advertiser page, run dates | Public Ad Library |
| `advertisers` | **Ad Library advertisers (pages)** matching your keyword — name, category, likes, verification, linked Instagram | Public Ad Library |
| `events` | Public **Facebook events** matching your keyword — name, date, venue, interested/going counts, cover image | Public events search |
| `marketplace` | **Marketplace listings** matching your keyword near a location — title, price, city, photo, delivery type | Public Marketplace |

### When to use it

- **Competitor ad intelligence** — pull every active ad a brand or niche is running (`ads`), or find all advertisers in a category (`advertisers`).
- **Event sourcing / promotion** — find upcoming events by topic and city (`events`).
- **Deal & price research** — track Marketplace listings for a product near a location (`marketplace`).
- **AI agents** — one keyword in, structured JSON out; ideal as an MCP tool call.

**When NOT to use it:** this actor searches only the four cookieless surfaces above. Facebook's global **post / page / profile / group** keyword search is login-gated and is not offered here. Use these sibling actors instead:

- Posts by keyword within pages/groups → **facebook-post-search-scraper**
- A specific page's data → **facebook-page-scraper**
- A group's posts/members → **facebook-group-posts-scraper**, **facebook-group-members-scraper**
- Comments → **facebook-comments-scraper**

### Output

One flat record per result. Fields are populated per surface (event fields on events, price fields on marketplace, ad fields on ads, etc.) and empty fields are omitted.

```json
{
  "searchType": "ads",
  "resultType": "ad",
  "query": "electric bike",
  "position": 1,
  "id": "1378176106734781",
  "adArchiveId": "1378176106734781",
  "url": "https://www.facebook.com/ads/library/?id=1378176106734781",
  "title": "Summer Sale — 40% Off E-Bikes",
  "imageUrl": "https://scontent.xx.fbcdn.net/....jpg",
  "pageName": "VoltRide",
  "pageId": "119749581219299",
  "isActive": true,
  "startDate": "2026-05-01T00:00:00.000Z",
  "ctaText": "Shop now",
  "ctaType": "SHOP_NOW",
  "linkUrl": "https://voltride.com/summer",
  "adText": "Ride further for less...",
  "displayFormat": "IMAGE",
  "pageCategories": ["Sporting goods"],
  "scrapeSource": "scrapecreators",
  "scrapedAt": "2026-07-01T12:00:00.000Z"
}
```

An event record:

```json
{
  "searchType": "events",
  "resultType": "event",
  "query": "coffee festival",
  "title": "Austin Coffee Festival 2026",
  "url": "https://www.facebook.com/events/24659081027102562/",
  "startTime": "2026-05-22T17:00:00.000Z",
  "dateText": "Fri, May 22",
  "placeName": "Palmer Events Center",
  "interestedCount": 2100,
  "goingCount": 640,
  "imageUrl": "https://scontent.xx.fbcdn.net/....jpg",
  "scrapeSource": "scrapecreators",
  "scrapedAt": "2026-07-01T12:00:00.000Z"
}
```

### Pricing

Pay-per-event (plus optional pay-per-usage):

- **Actor start:** $0.00005 per run.
- **Result found:** **$0.005 per result** returned (event, listing, ad, or advertiser).

A 50-result run costs about **$0.25**. You are only charged for results actually returned — zero-result searches cost only the start fee.

### Input

| Field | Required | Default | Notes |
|---|---|---|---|
| `query` | ✅ | — | Keyword to search, e.g. `electric bike`. Plain text, not a URL. |
| `searchType` | | `ads` | `ads` · `advertisers` · `events` · `marketplace`. |
| `maxResults` | | `50` | 1–500. |
| `location` | for `marketplace` | `Austin, TX` | City/place; resolved to coordinates automatically. |
| `country` | | all | 2-letter ISO code to scope `ads` (e.g. `US`). |
| `adStatus` | | `ACTIVE` | `ACTIVE` · `INACTIVE` · `ALL` (ads only). |
| `adType` | | `ALL` | `ALL` · `POLITICAL_AND_ISSUE_ADS` (ads only). |

#### Example — Ad Library ads

```json
{ "query": "electric bike", "searchType": "ads", "country": "US", "maxResults": 50 }
```

#### Example — Events

```json
{ "query": "coffee festival", "searchType": "events", "maxResults": 30 }
```

#### Example — Marketplace

```json
{ "query": "mountain bike", "searchType": "marketplace", "location": "Denver, CO", "maxResults": 40 }
```

#### Example — Advertisers

```json
{ "query": "skincare", "searchType": "advertisers", "maxResults": 25 }
```

### Using from the API

```bash
curl -X POST "https://api.apify.com/v2/acts/khadinakbar~facebook-search-scraper/runs?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "query": "electric bike", "searchType": "ads", "country": "US", "maxResults": 50 }'
```

### Using from an AI agent (MCP)

Exposed via Apify MCP as `apify--facebook-search-scraper`. Point your MCP client at `https://mcp.apify.com` and the agent can call it with a keyword and `searchType`. Results come back as structured JSON ready for reasoning.

### How it works

The actor is provider-backed and cookieless — it never asks you for a Facebook login. It routes each `searchType` to the correct managed data provider (ScrapeCreators primary, SociaVault fallback; Events is ScrapeCreators-only), paginates up to your `maxResults`, and normalizes every surface into one flat schema. Empty results return gracefully; genuine provider outages fail honestly with a clear status message rather than pretending to succeed.

### Notes & limits

- Only the four cookieless surfaces above are supported. Global post/page/profile/group keyword search is login-gated (see sibling actors).
- Marketplace requires a `location` to anchor listings to a place.
- Ad Library coverage reflects what Meta exposes publicly and varies by region/regulation.

### Legal

This actor collects only publicly available data from Facebook's public surfaces. It performs no login and accesses no private or login-gated content. You are responsible for using the data in compliance with Facebook's Terms of Service, applicable laws (including GDPR/CCPA where relevant), and any rights in the data. Do not use it to collect personal data unlawfully.

# Actor input Schema

## `query` (type: `string`):

The keyword to search Facebook for. Free text, e.g. 'coffee festival', 'Nike', or 'electric bike'. Applies to whichever surface you pick in searchType. This is NOT a Facebook URL — pass a plain keyword, not a page or profile link.

## `searchType` (type: `string`):

Which Facebook surface to search. 'ads' and 'advertisers' query the public Ad Library; 'events' finds public events; 'marketplace' finds for-sale listings (needs a location). Defaults to 'ads'. These are the only surfaces Facebook lets you keyword-search without logging in — public post/page/profile keyword search is login-gated and served by sibling actors.

## `maxResults` (type: `integer`):

Maximum number of results to return and charge for. Ranges 1–500, defaults to 50. The actor paginates until it hits this cap or runs out of results. Keep it modest for quick, low-cost runs.

## `location` (type: `string`):

City or place used to anchor Marketplace listings, e.g. 'Austin, TX' or 'London, UK'. Required only when searchType is 'marketplace'; ignored for every other search type. The actor resolves it to coordinates automatically. Leave empty unless searching Marketplace.

## `country` (type: `string`):

Two-letter ISO country code to scope Ad Library results, e.g. 'US', 'GB', or 'IN'. Used only when searchType is 'ads'; leave empty to search all countries. Does not affect events, advertisers, or marketplace. Example: 'US'.

## `adStatus` (type: `string`):

Filter Ad Library ads by run status. 'ACTIVE' returns currently-running ads, 'INACTIVE' returns stopped ads, 'ALL' returns both. Defaults to 'ACTIVE'. Applies only to searchType 'ads'.

## `adType` (type: `string`):

Restrict Ad Library ads to all ads or only political/issue ads. 'ALL' returns every ad type; 'POLITICAL\_AND\_ISSUE\_ADS' returns only regulated political ads. Defaults to 'ALL'. Applies only to searchType 'ads'.

## `fallbackProvider` (type: `string`):

Which backend data provider to use. 'auto' tries ScrapeCreators first then SociaVault; the other options force one provider. Defaults to 'auto'. Events search only works via ScrapeCreators regardless of this setting.

## Actor input object example

```json
{
  "query": "electric bike",
  "searchType": "ads",
  "maxResults": 50,
  "location": "London, UK",
  "country": "US",
  "adStatus": "ACTIVE",
  "adType": "ALL",
  "fallbackProvider": "auto"
}
```

# Actor output Schema

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

No description

## `summary` (type: `string`):

No description

## `runSummary` (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 = {
    "query": "coffee",
    "location": "Austin, TX"
};

// Run the Actor and wait for it to finish
const run = await client.actor("khadinakbar/facebook-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 = {
    "query": "coffee",
    "location": "Austin, TX",
}

# Run the Actor and wait for it to finish
run = client.actor("khadinakbar/facebook-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 '{
  "query": "coffee",
  "location": "Austin, TX"
}' |
apify call khadinakbar/facebook-search-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/WR1UmOlmJdvRQmZjo/builds/pkdPXTTBLEIFfhyIe/openapi.json
