# Facebook Keyword Search for Videos, Hashtag Posts & Places (`xyrelith-data/fb-keyword-search-scraper`) Actor

Search public Facebook videos, hashtag posts and Pages/places by keyword without login. Returns captions, engagement, addresses, phones, ratings, review counts and coordinates.

- **URL**: https://apify.com/xyrelith-data/fb-keyword-search-scraper.md
- **Developed by:** [Xyrelith Data](https://apify.com/xyrelith-data) (community)
- **Categories:** Social media, Lead generation, Videos
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.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 Keyword Search for Videos, Hashtag Posts & Places

Search public Facebook content by keyword without logging in. The actor reads Facebook's public Watch search for videos, its hashtag Explore pages for featured public posts, and its public Page directory plus Ad Library page suggestions for businesses and places. Every row is real public data; empty fields are omitted instead of being filled with nulls or placeholders.

Facebook keeps most logged-out search surfaces closed. This actor is deliberately built around the surfaces that still answer anonymously, and it tells you the limits plainly in the sections below.

### What this actor does

- **Four ways to search:** `videos` for Watch keyword results, `posts` for public hashtag posts, `places` for public Pages/businesses, and `urls` for direct Facebook links.
- **Useful video rows:** caption, owner, publish date, duration, view count, reactions, comments, shares, live status and a thumbnail stored in the run's key-value store so it does not expire.
- **Useful post rows:** text, author, publish date, hashtags, mentions, links, images and engagement counts. Turn on related-hashtag expansion to follow up to three hashtags found in the first matching post.
- **Useful place rows:** address, city, country, postal code, map coordinates, phone, email, website, category, recommendation percentage, review count, followers, check-ins, price range and services.
- **Filters that work client-side:** publish window, minimum video views, author type, must-contain-keyword and places-with-a-location.
- **No login, no cookies, no API key.** No Facebook account is needed to run it.

### Output per video (mode = `videos`)

- `videoId` — Facebook video identifier.
- `postId` — identifier of the post that contains the video, when Facebook exposes it.
- `url` — canonical reel or Watch URL.
- `caption` — public caption text, when present.
- `publishDate` — ISO 8601 publish date.
- `ownerName`, `ownerId`, `ownerUrl`, `ownerType` — video owner and whether it is a page or profile.
- `ownerVerified` — verification badge when Facebook exposes it to logged-out visitors.
- `thumbnailUrl` — durable thumbnail stored in the run's key-value store.
- `thumbnailUrlOriginal` — the original signed Facebook CDN thumbnail.
- `durationSeconds` — video length in seconds.
- `viewCount`, `reactionCount`, `commentCount`, `shareCount` — public engagement counters.
- `isLive` — whether the video is a live broadcast.
- `liveViewerCount` — current live viewers when the video is live.
- `searchTerm`, `searchRank` — the query that found the row and its order in that query.
- `searchUrl` — the Facebook search URL that produced the row.
- `recordType`, `sourceUrl`, `scrapedAt`.

### Output per post (mode = `posts`)

- `postId`, `url`, `text`, `publishDate`.
- `authorName`, `authorId`, `authorUrl`, `authorType`, `authorVerified`.
- `groupName`, `groupId` — when the post is attached to a public group.
- `hashtag` — the hashtag Explore page that surfaced the post.
- `hashtags`, `mentions`, `links` — extracted from the post text.
- `imageUrls` — durable copies of post photos in the run's key-value store; `imageUrlsOriginal` keeps the signed Facebook URLs.
- `videoUrls` — public video/reel page URLs attached to the post.
- `reactionCount`, `commentCount`, `shareCount`, `viewCount`.
- `searchTerm`, `searchRank`, `searchUrl`, `recordType`, `sourceUrl`, `scrapedAt`.

### Output per place (mode = `places`)

- `placeId` — numeric Facebook Page identifier.
- `name`, `url`, `verified`, `category`.
- `address`, `city`, `region`, `postalCode`, `country`.
- `latitude`, `longitude` — coordinates from the Page's public map link.
- `phone`, `email`, `website`.
- `ratingText`, `recommendPercentage`, `reviewCount` — Facebook recommendation data when the Page shows it.
- `followers`, `likes`, `checkins`, `talkingAboutCount`.
- `priceRange`, `services`, `businessHours`, `about`.
- `searchTerm`, `searchRank`, `searchUrl`, `recordType`, `sourceUrl`, `scrapedAt`.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | string | `videos` | `videos`, `posts`, `places` or `urls`. |
| `searchTerms` | array | – | Keywords or hashtags; one search per term. Required for `videos`, `posts` and `places`. The daily prefill uses `["coffee"]`. |
| `startUrls` | array | – | Direct Facebook search, post, reel, hashtag or Page URLs for `urls`. |
| `maxItems` | integer | `50` | Total row cap across all terms and URLs (1–5,000). |
| `maxItemsPerTerm` | integer | `30` | Row cap for one search term (1–500). |
| `requireSearchTerm` | boolean | `false` | Keep only rows whose text, name, category or hashtag contains every word of the term. |
| `minViews` | integer | `0` | Drop videos below this view count (mode `videos`). |
| `postSourceType` | string | `any` | Keep `page`, `profile` or `group` authors when the author type is exposed. |
| `sortBy` | string | `relevance` | `relevance` keeps Facebook order; `recent` asks for recent videos and sorts by publish date. |
| `dateFilter` | string | `any` | `past-24h`, `past-week`, `past-month` or `past-year`; rows without a date pass through. |
| `location` | string | – | City or country added to the search phrase for places and videos. |
| `expandHashtags` | boolean | `false` | For posts, follow up to three hashtags found in the first matching post. |
| `requireLocation` | boolean | `false` | For places, keep only Pages with an address or map coordinates. |
| `rehostMedia` | boolean | `true` | Copy signed Facebook images/thumbnails into Apify storage so the URLs stay available. |

#### Example: find videos about a topic

```json
{
  "mode": "videos",
  "searchTerms": ["coffee", "espresso"],
  "sortBy": "recent",
  "dateFilter": "past-month",
  "minViews": 1000,
  "maxItems": 25
}
```

#### Example: collect public hashtag posts

```json
{
  "mode": "posts",
  "searchTerms": ["coffee", "specialtycoffee"],
  "expandHashtags": true,
  "maxItems": 20
}
```

#### Example: discover coffee places in a city

```json
{
  "mode": "places",
  "searchTerms": ["coffee"],
  "location": "London",
  "requireLocation": true,
  "maxItems": 30
}
```

#### Example: read direct Facebook links

```json
{
  "mode": "urls",
  "startUrls": [
    { "url": "https://www.facebook.com/reel/5046057592281891/" },
    { "url": "https://www.facebook.com/ozonecoffeeuk/" }
  ],
  "maxItems": 10
}
```

### Use cases

- **Social listening** — track public video conversations around a product, city or event.
- **Local lead research** — collect public business Pages with phone, address, website and rating.
- **Content research** — find public videos and hashtag posts in a niche before planning a campaign.
- **Brand monitoring** — pull public engagement counts for a keyword without touching an account.
- **Data enrichment** — paste known Facebook Page or post URLs and get normalized records.

### Limits and Facebook behaviour

Facebook does not publish a complete logged-out keyword index. This actor returns what the public surfaces expose:

- **Videos:** Facebook's Watch search serves a small first page (typically 5–7 videos per request). The actor asks several public variants of the same search and de-duplicates, which usually yields about 7–14 unique videos per term. Deep cursor pagination is not available without login, so use more terms for more rows.
- **Posts:** Facebook's generic `/search/posts` route returns 404 to logged-out visitors, and its search GraphQL rate-limits anonymous clients. Post discovery therefore uses public hashtag Explore pages (one featured post per hashtag request, plus related hashtags when enabled) and any direct post URLs you supply. This is not the full public post index.
- **Places:** Facebook's Places tab is likewise closed to logged-out visitors. Place discovery uses the public Ad Library Page suggestions and then reads each Page's public root. A suggestion can be a brand, artist or online business with no street address; turn on `requireLocation` to keep only Pages that publish a location.
- **Engagement counts** are only those Facebook displays to logged-out visitors. Hidden counts are omitted.
- **Media URLs** from Facebook's CDN are signed and expire. The actor copies images and thumbnails into Apify storage by default and keeps the original URL in `<field>Original`.
- **Location** is a query hint, not a strict geographic boundary. Use the returned address to verify.

#### Do I need a Facebook account or cookies?

No. The actor never asks for a login, cookie or Facebook API key. It reads only public pages.

#### Do I need to set up a proxy?

No. The actor chooses a working public connection automatically. You do not configure a proxy.

#### Why are there fewer posts than a logged-in search would show?

Because Facebook requires a session for its full search index. The actor stays cookie-free, so it uses the hashtag Explore surface instead and says so here rather than pretending to have the full index.

#### Are the image URLs permanent?

The default `rehostMedia: true` copies them into Apify storage, so the `thumbnailUrl` and `imageUrls` fields keep working after Facebook's signed links expire. Set it to `false` if you prefer the original Facebook URLs.

#### Is this affiliated with Facebook or Meta?

No. This is an independent third-party actor that reads public Facebook pages.

# Actor input Schema

## `mode` (type: `string`):

Which public Facebook surface to search.

## `searchTerms` (type: `array`):

Keywords or hashtags to search. One search per term. (mode=videos, posts, places)

## `startUrls` (type: `array`):

Facebook search, post, video or place URLs to read directly. (mode=urls)

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

Total result cap across all search terms and URLs.

## `maxItemsPerTerm` (type: `integer`):

Per-term result cap across all variants of one search term.

## `requireSearchTerm` (type: `boolean`):

Keep only rows whose text, name, category or hashtag contains every word of the search term.

## `minViews` (type: `integer`):

Drop videos below this view count. (mode=videos)

## `postSourceType` (type: `string`):

Keep posts/videos from Pages, profiles or groups when Facebook exposes the author type. (mode=posts, videos)

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

Relevance uses Facebook search order; recent asks Facebook for the newest videos and sorts results by publish date. (mode=videos)

## `dateFilter` (type: `string`):

Keep only videos/posts published within this window when a publish date is exposed. (mode=posts, videos)

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

City or country added to the search phrase for Places and Videos, e.g. London.

## `expandHashtags` (type: `boolean`):

For posts, also read up to three hashtags found in the first matching post to find more public posts. Adds requests. (mode=posts)

## `requireLocation` (type: `boolean`):

Keep only Pages that publish an address or map coordinates. (mode=places)

## `rehostMedia` (type: `boolean`):

Copy post images and video thumbnails to the run key-value store so the URLs do not expire. Turn off to keep the original Facebook CDN URLs.

## Actor input object example

```json
{
  "mode": "videos",
  "searchTerms": [
    "coffee"
  ],
  "maxItems": 3,
  "maxItemsPerTerm": 3,
  "requireSearchTerm": false,
  "minViews": 0,
  "postSourceType": "any",
  "sortBy": "relevance",
  "dateFilter": "any",
  "location": "",
  "expandHashtags": false,
  "requireLocation": false,
  "rehostMedia": true
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset containing public Facebook videos, posts and places.

# 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 = {
    "mode": "videos",
    "searchTerms": [
        "coffee"
    ],
    "maxItems": 3,
    "maxItemsPerTerm": 3,
    "requireSearchTerm": false,
    "minViews": 0,
    "postSourceType": "any",
    "sortBy": "relevance",
    "dateFilter": "any",
    "location": "",
    "expandHashtags": false,
    "requireLocation": false,
    "rehostMedia": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("xyrelith-data/fb-keyword-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 = {
    "mode": "videos",
    "searchTerms": ["coffee"],
    "maxItems": 3,
    "maxItemsPerTerm": 3,
    "requireSearchTerm": False,
    "minViews": 0,
    "postSourceType": "any",
    "sortBy": "relevance",
    "dateFilter": "any",
    "location": "",
    "expandHashtags": False,
    "requireLocation": False,
    "rehostMedia": True,
}

# Run the Actor and wait for it to finish
run = client.actor("xyrelith-data/fb-keyword-search-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 '{
  "mode": "videos",
  "searchTerms": [
    "coffee"
  ],
  "maxItems": 3,
  "maxItemsPerTerm": 3,
  "requireSearchTerm": false,
  "minViews": 0,
  "postSourceType": "any",
  "sortBy": "relevance",
  "dateFilter": "any",
  "location": "",
  "expandHashtags": false,
  "requireLocation": false,
  "rehostMedia": true
}' |
apify call xyrelith-data/fb-keyword-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,xyrelith-data/fb-keyword-search-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/6cWb90M5mWHHhPz3O/builds/iWZyOhRDXGOcJUHsx/openapi.json
