# Facebook Posts Search across Groups Scraper (`lofomachines/facebook-groups-posts-search-scraper`) Actor

The only Facebook group post scraper. Search posts by keyword across all public groups. No login, cookies or API key needed. 43 countries, 30 languages, real-time streaming.

- **URL**: https://apify.com/lofomachines/facebook-groups-posts-search-scraper.md
- **Developed by:** [Lofomachines](https://apify.com/lofomachines) (community)
- **Categories:** Lead generation, Social media
- **Stats:** 4 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

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

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 Groups Post Scraper

> **Collect hundreds to thousands of public Facebook group posts that contain your keyword.** No Facebook login. No account. No API key. The actor scans public groups and returns only the posts whose text actually matches your keyword — with date and country filters.

---

### Why This Actor?

Most Facebook scrapers force you to already know which group you want, and require a logged-in session. **This actor finds matching posts across all public groups** — and keeps only the ones whose *text* contains your keyword, so your dataset is relevant, not noise.

| Feature | This Actor | Typical scrapers |
|---|---|---|
| Hundreds–thousands of posts per keyword | ✅ | ❌ |
| Keeps only posts whose **text** contains the keyword | ✅ | ❌ |
| No Facebook account / login | ✅ | ❌ |
| Date filtering on real post dates | ✅ | Partial |
| 70 countries | ✅ | Partial |

---

### How It Works

1. You enter one or more keywords (and, optionally, a start date and country).
2. The actor scans public Facebook groups and collects candidate posts, scaling how deeply it scans to your **Max posts** target.
3. Each post is read and **kept only if** it has text, the **keyword appears in that text** (accent/case-insensitive), and — when a start date is set — its real publication date is on or after it.
4. Posts are de-duplicated by URL, and the run stops the moment it reaches your target.

No login, cookies, or browser automation are involved.

---

### Input Parameters

| Field | Required | Description |
|-------|----------|-------------|
| `keywords` | ✅ | Phrases to look for; only posts whose text contains the phrase are kept |
| `maxPosts` | ❌ | Target posts per keyword (1–3000, default 100). The actor scales scan depth to this target and stops once reached |
| `countryCode` | ❌ | Country bias — 70 supported (e.g. `us`, `gb`, `it`, `br`). Leave empty for global |

---

### Input Examples

**Collect 1 000 gardening posts in the US:**
```json
{
    "keywords": ["gardening"],
    "maxPosts": 1000,
    "countryCode": "us"
}
````

***

### Output Fields

One item per post.

| Field | Type | Description |
|-------|------|-------------|
| `result_type` | string | Always `"post"` |
| `post_url` | string | Canonical URL of the post |
| `text` | string | Full post text content |
| `image_url` | string | URL of the post's main image (if any) |
| `author_name` | string | Display name of the post author |
| `author_id` | string | Facebook author ID (pfbid) |
| `date` | string | Publication timestamp (ISO 8601) |
| `reaction_count` | integer | Total number of reactions |
| `comment_count` | integer | Total number of comments |
| `share_count` | integer | Total number of shares |
| `group_name` | string | Name of the group the post belongs to |
| `group_url` | string | URL of the parent group |
| `group_id` | string | Numeric group ID |
| `processed_at` | string | When this item was scraped (ISO 8601) |

#### Example item

```json
{
    "result_type": "post",
    "post_url": "https://www.facebook.com/groups/raisedbedgardening/posts/30238911095722702/",
    "text": "Hi everybody. My raised beds are suffering from a major issue this year…",
    "author_name": "Jane Doe",
    "date": "2025-05-15T14:02:11.000Z",
    "reaction_count": 42,
    "comment_count": 13,
    "share_count": 1,
    "group_name": "Raised Bed Gardening",
    "group_url": "https://www.facebook.com/groups/raisedbedgardening/",
    "group_id": "1156935537680311",
    "processed_at": "2026-06-05T22:51:00.000Z"
}
```

***

### Notes

- `maxPosts` is a target and ceiling (max 3000). For niche keywords with few matching posts, the run may return fewer.
- Larger targets take longer, since the actor scans more deeply to find enough matching posts.

***

### FAQ

**Does this require a Facebook account or API key?**
No — no account, no login, no cookies, no API key.

**Can I scrape private groups?**
No. Only posts in public groups are accessible.

**Why might fewer posts come back than `maxPosts`?**
The keyword may simply be sparse across public groups. Widen the date range or try related keywords.

**Does it work for non-English keywords?**
Yes — matching is accent- and case-insensitive across all languages.

***

### Legal & Compliance

This actor only accesses **publicly available** Facebook group posts. It does not log in, bypass authentication, or access private data. Users are responsible for ensuring their use complies with applicable laws including GDPR, CCPA, and Facebook's Terms of Service.

# Actor input Schema

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

Words or phrases to look for. Only posts whose text contains the phrase are kept. Example: `gardening`, `bitcoin trading`, `vintage cars`.

## `afterDate` (type: `string`):

How far back to collect posts. The scraper starts from today and goes back day by day within the selected range, keeping only posts published inside it.

## `maxPosts` (type: `integer`):

Target number of matching posts to collect per keyword (max 3000). The actor automatically scales how deeply it scans Facebook to this target and stops as soon as it is reached.

## `countryCode` (type: `string`):

Regional bias for results. Affects which regional posts are prioritised. Select from the list or type any [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code. Leave empty for global. *(Optional)*

## Actor input object example

```json
{
  "afterDate": "this_year",
  "maxPosts": 100,
  "countryCode": "us"
}
```

# Actor output Schema

## `overview` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("lofomachines/facebook-groups-posts-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("lofomachines/facebook-groups-posts-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 '{}' |
apify call lofomachines/facebook-groups-posts-search-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Posts Search across Groups Scraper",
        "description": "The only Facebook group post scraper. Search posts by keyword across all public groups. No login, cookies or API key needed. 43 countries, 30 languages, real-time streaming.",
        "version": "0.1",
        "x-build-id": "yfpCo94lwaFnYb2vj"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/lofomachines~facebook-groups-posts-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-lofomachines-facebook-groups-posts-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/lofomachines~facebook-groups-posts-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-lofomachines-facebook-groups-posts-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/lofomachines~facebook-groups-posts-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-lofomachines-facebook-groups-posts-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",
                "properties": {
                    "keywords": {
                        "title": "Keywords",
                        "type": "array",
                        "description": "Words or phrases to look for. Only posts whose text contains the phrase are kept. Example: `gardening`, `bitcoin trading`, `vintage cars`.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "afterDate": {
                        "title": "Time range",
                        "enum": [
                            "last_month",
                            "this_year"
                        ],
                        "type": "string",
                        "description": "How far back to collect posts. The scraper starts from today and goes back day by day within the selected range, keeping only posts published inside it.",
                        "default": "this_year"
                    },
                    "maxPosts": {
                        "title": "Max posts per keyword",
                        "minimum": 100,
                        "maximum": 3000,
                        "type": "integer",
                        "description": "Target number of matching posts to collect per keyword (max 3000). The actor automatically scales how deeply it scans Facebook to this target and stops as soon as it is reached.",
                        "default": 100
                    },
                    "countryCode": {
                        "title": "Country",
                        "type": "string",
                        "description": "Regional bias for results. Affects which regional posts are prioritised. Select from the list or type any [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code. Leave empty for global. *(Optional)*",
                        "default": "us"
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
