# Facebook Page Search Results Scraper (`memo23/apify-facebook-page-search-scraper`) Actor

Scrape facebook pages from search results and get important details such as page name, description, photo url, is verified, tag or category, reviews, price range, location, hours open, number of followers and page link.

- **URL**: https://apify.com/memo23/apify-facebook-page-search-scraper.md
- **Developed by:** [Muhamed Didovic](https://apify.com/memo23) (community)
- **Categories:** Lead generation, Social media
- **Features:** Limited permissions
- **Stats:** 98 total users, 0 monthly users, 100.0% runs succeeded, 3 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $2.00 / 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.

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 Search Pages Scraper

### How it works

This actor allows you to scrape facebook pages from search and get important details such as page name, description, photo url, is verified, tag or category, reviews, price range, location, hours open, number of followers and page link.

### Features

Multiple Search Queries: Supports scraping based on multiple search URLs, formatted as https://www.facebook.com/search/pages/?q=your_query.
Required Authentication over cookies: Users can log in to access a broader range of questions and answers.
Customizable: Flexible configuration options to suit various scraping needs.

### How to Use

1. **Set Up**: Ensure you have an Apify account and access to the Apify platform.
2. **Install [EditThisCookie](https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg) Chrome extension**.
3. **Login to Your Facebook Account**.
4. **Export Cookies**: While on the Facebook tab, click on the extension and export the cookies.
5. **Input Cookies**: Paste the cookies into this actor's Cookie input field.
6. **Specify Search URLs**: Input your search URLs in the format `https://www.facebook.com/search/pages/?q=your_query`. You can add multiple URLs for a broader search scope.
7. **(Optional) Set Max Pages to Scrape**: Determine the number of pages to scrape.
8. **(Optional) Set Scroll Delays**: Set the Min Delay for Scroll and Max Delay for Scroll to avoid being blocked by Facebook and to get maximum results.
9. **(Optional) Set location**: Input location as city and country example: "London, United Kingdom".
10. **(Optional) Configure Proxy Settings**: For enhanced reliability.
11. **Run the Actor**: Execute the actor to start scraping.
12. **Data Collection**: The scraper will output data in your chosen format, which can include JSON, HTML, CSV, Excel, or other formats supported by Apify.

### Input Data

Here's a simple example of how to set up a search for "medical" pages in Facebook:

```json
{
    "cookies": [
        {
            "domain": ".facebook.com",
            "expirationDate": 1740231415.466268,
            "hostOnly": false,
            "httpOnly": false,
            "name": "c_user",
            "path": "/",
            "sameSite": "no_restriction",
            "secure": true,
            "session": false,
            "storeId": "0",
            "value": "1234804295",
            "id": 1
        }
    ],
    "maxDelay": 5,
    "maxPages": 100,
    "minDelay": 2,
    "location": "London, United Kingdom",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    },
    "startUrls": [
        {
            "url": "https://www.facebook.com/search/pages/?q=medical"
        }
    ]
}
```

### Output Structure

The output data typically includes:

```json
[
    {
        photoURL: 'https://scontent.fsjj1-1.fna.fbcdn.net/v/t39.30808-1/301835450_484818216984011_497624981665904398_n.jpg?stp=dst-jpg_s120x120&_nc_cat=111&ccb=1-7&_nc_sid=f4b9fd&_nc_ohc=awPG65E1IF4Q7kNvgFVMseg&_nc_ht=scontent.fsjj1-1.fna&_nc_gid=AVHsdmsNHOcoXXr3Kydi6_n&oh=00_AYAmArKfoc0AueFIcVVaukYemihQIzK4FuapdHCCHyAWvA&oe=66D96323',
        pageName: 'Alicat Cleaning Services',
        isVerified: 'no',
        tag: 'Cleaning Service',
        reviews: null,
        priceRange: null,
        location: null,
        hoursOpen: null,
        followers: '2 followers',
        description: "Hi I'm Dean Holmes and I've been running Alicat Cleaning and Gardening Services for the past 9 years. Previously to this I worked in Health and Social Care for 25 years. I'm based in Preston and I'm happy to take on work across the whole of Lancashire. ",
        pageLink: 'https://www.facebook.com/profile.php?id=100063675116088&__tn__=%3C',
        pageSlug: 'profile.php'
    },
    {
        photoURL: 'https://scontent.fsjj1-1.fna.fbcdn.net/v/t39.30808-1/420200785_122094762194211145_7598623163127668115_n.jpg?stp=c51.0.1023.1023a_dst-jpg_s120x120&_nc_cat=106&ccb=1-7&_nc_sid=f4b9fd&_nc_ohc=FaI5Y9pH34UQ7kNvgHiViTF&_nc_ht=scontent.fsjj1-1.fna&_nc_gid=AVHsdmsNHOcoXXr3Kydi6_n&oh=00_AYCN4sPoAwM_KF3lJiLUsd-teTJ3kXRpi9GWkji_cWMrwQ&oe=66D952B6',
        pageName: 'Sarah’s cleaning services',
        isVerified: 'no',
        tag: 'Cleaning Service',
        reviews: null,
        priceRange: null,
        location: null,
        hoursOpen: null,
        followers: '81 followers',
        description: 'Professional cleaning services, fully insured and DBS checked. https://www.sarahscleaningservices.uk/',
        pageLink: 'https://www.facebook.com/profile.php?id=61556334353647&__tn__=%3C',
        pageSlug: 'profile.php'
    },
    ...
]
```

### Support

- For issues or feature requests, please use the [Issues](https://console.apify.com/actors/HBdQuY0Qwd2bDGM4a/issues) section of this actor.
- If you need customization or have questions, feel free to contact the author:
  - Author's website: <https://muhamed-didovic.github.io/>
  - Email: <muhamed.didovic@gmail.com>
  - My Apify Actors/Scrapers: <https://apify.com/memo23>

### Additional Services

- Request customization or whole dataset: <muhamed.didovic@gmail.com>
- If you need anything else scraped, or this actor customized, email: <muhamed.didovic@gmail.com>
- For API services of this scraper (no Apify fee, just usage fee for the API), contact: <muhamed.didovic@gmail.com>

# Actor input Schema

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

URLs to start with.

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

Location of the search

## `maxPages` (type: `integer`):

Limit number of extracted pages (overall)

## `minDelay` (type: `integer`):

Minimum delay to wait before scrolling to the bottom of the page. This is useful to avoid getting blocked by Facebook. The delay is in seconds.

## `maxDelay` (type: `integer`):

Maximum delay to wait before scrolling to the bottom of the page. This is useful to avoid getting blocked by Facebook. The delay is in seconds.

## `cookies` (type: `array`):

<p>Cookie used to authorize actor with facebook.com. Install <a rel="noopener noreferrer nofollow" target="_blank" href="https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg" previewlistener="true">EditThisCookie</a> chrome extension. Login to your facebook.com account. Click on the extension and export the facebook.com cookies. Insert the contents here</p>
## `proxyConfiguration` (type: `object`):

Specifies proxy servers that will be used by the scraper in order to hide its origin.<br><br>For details, see <a href='https://apify.com/apify/web-scraper#proxy-configuration' target='_blank' rel='noopener'>Proxy configuration</a> in README.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.facebook.com/search/pages/?q=medical"
  ],
  "location": "",
  "maxPages": 100,
  "minDelay": 5,
  "maxDelay": 10,
  "cookies": [],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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 = {
    "startUrls": [
        "https://www.facebook.com/search/pages/?q=medical"
    ],
    "cookies": [],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("memo23/apify-facebook-page-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 = {
    "startUrls": ["https://www.facebook.com/search/pages/?q=medical"],
    "cookies": [],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("memo23/apify-facebook-page-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 '{
  "startUrls": [
    "https://www.facebook.com/search/pages/?q=medical"
  ],
  "cookies": [],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call memo23/apify-facebook-page-search-scraper --silent --output-dataset

```

## MCP server setup

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