# Meta Posts Scraper (`data_ops_main/meta-posts-scraper`) Actor

Scrapes Facebook and Instagram posts by keywords and hashtags using Playwright. Returns raw post data including captions, engagement metrics (likes, comments, shares, views), images, and author info.

- **URL**: https://apify.com/data\_ops\_main/meta-posts-scraper.md
- **Developed by:** [yourlocalhost](https://apify.com/data_ops_main) (community)
- **Categories:** Developer tools, Social media, Automation
- **Stats:** 13 total users, 2 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.20 / 1,000 meta starters

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/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

## Meta Posts Scraper - Facebook & Instagram Post Scraper 🚀

**Scrape Facebook and Instagram posts by keyword and hashtag - no code required.** Pull captions, likes, comments, shares, views, images, videos, top comments, and author details from both Meta platforms in one run, then export to JSON, CSV, Excel, or push straight into your own app via API.

> ✅ Both platforms in one Actor  •  ✅ Keyword **and** hashtag search  •  ✅ Full engagement metrics  •  ✅ Structured, ready-to-use data  •  ✅ Schedule, monitor & integrate on Apify

***

### ⚡ What you get in 60 seconds

Type in a few keywords or hashtags, hit **Start**, and get a clean, structured dataset of real Facebook and Instagram posts - the kind of social data that normally takes hours of manual copy-pasting or an expensive enterprise tool.

| Without this Actor | With this Actor |
|--------------------|-----------------|
| Manually scrolling feeds and copy-pasting | One click, structured dataset |
| Separate tools for Facebook and Instagram | **Both platforms, one run** |
| Screenshots and guesswork on engagement | Exact likes, comments, shares, views |
| Data trapped in your browser | Export to JSON/CSV/Excel or call the API |

### 👤 Who it's for

- **Marketers & social listeners** tracking brand mentions, sentiment, and campaign buzz
- **Content creators & agencies** hunting viral posts and trending hashtags
- **E-commerce & dropshippers** spotting trending products before they peak
- **Analysts & researchers** benchmarking engagement across creators and competitors
- **Developers** who want social data piped into a pipeline via a clean JSON API

### ✨ Features

- 🔎 **Keyword + hashtag search** across Facebook and Instagram
- 📊 **Full engagement metrics** - likes/reactions, comments, shares, and (for Reels) views
- 🖼️ **Rich media** - image URLs, video source URLs, and poster thumbnails
- 💬 **Top comments** with author and body for sentiment analysis
- 🏷️ **Hashtag extraction** and author profile info (handle, URL, avatar)
- 🔐 **Optional login** per platform to reach data behind authentication walls
- 🌐 **Proxy support** (residential recommended) to scrape reliably at scale
- 📦 **Structured output** ready for BI tools, spreadsheets, and databases

***

### 🛠️ How to use the Meta Posts Scraper

1. Click **Try for free** / open the Actor in [Apify Console](https://console.apify.com).
2. Choose your **platform** - Facebook, Instagram, or both.
3. Enter your **search keywords** and/or **hashtags**.
4. (Optional) Add login credentials and a **residential proxy** for richer, more reliable results.
5. Set **Posts per query** and click **Start**.
6. When the run finishes, open the **Output / Dataset** tab and export to **JSON, CSV, or Excel** - or grab it from the API.

> 💡 **Tip:** Start small (e.g. `postsPerQuery: 5`) to preview the data shape, then scale up once you're happy.

***

### 💸 Pricing & how it scales

This Actor runs on the **Apify platform**, so you get scheduling, run monitoring, storage, proxy access, API, and 50+ integrations (Zapier, Make, Slack, Google Drive, webhooks) included around it.

- **Free plan** - Apify gives you **free monthly usage credits**, enough to test the Actor end-to-end and pull your first sample datasets at **$0**. Perfect for a proof of concept.
- **Need more posts?** A single run scales from a handful of posts to thousands. Upgrading from the free plan unlocks the compute, proxy bandwidth, and concurrency to collect **tens of thousands of posts per month** on a schedule - automatically.
- **Predictable costs** - you only pay for what a run actually uses. Preview cost on a small run, then extrapolate linearly before scaling.

> 🚀 **From free to scale:** the free tier is built for evaluation. When the data proves its value, a paid plan turns this from a one-off experiment into an automated, scheduled social-intelligence feed - no extra setup.

See the live [Apify pricing page](https://apify.com/pricing) for current plan limits.

***

### 📥 Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `platforms` | string | No | `"both"` | `"both"`, `"facebook"`, or `"instagram"` |
| `searchKeywords` | array | No | `[]` | Keywords to search for posts |
| `hashtags` | array | No | `[]` | Hashtags to search (without the `#`) |
| `postsPerQuery` | integer | No | `15` | Max posts per keyword/hashtag (1–100) |
| `fbEmail` | string | No | - | Facebook email for login |
| `fbPassword` | string | No | - | Facebook password (stored as a secret) |
| `igUsername` | string | No | - | Instagram username for login |
| `igPassword` | string | No | - | Instagram password (stored as a secret) |
| `loginFacebook` | boolean | No | `true` | Log in to Facebook before scraping |
| `loginInstagram` | boolean | No | `true` | Log in to Instagram before scraping |
| `proxyConfiguration` | object | No | off | Proxy settings - **residential strongly recommended** for Facebook/Instagram |

> **Tip:** Set `loginFacebook` / `loginInstagram` to `false` to scrape public data only without credentials.

#### Example input

```json
{
  "platforms": "both",
  "searchKeywords": ["trending products", "viral gadgets"],
  "hashtags": ["trending", "viralproducts"],
  "postsPerQuery": 15,
  "loginFacebook": false,
  "loginInstagram": false,
  "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] }
}
```

### 📤 Output

Each post is stored as a separate record in the dataset.

| Field | Type | Description |
|-------|------|-------------|
| `platform` | string | `"facebook"` or `"instagram"` |
| `post_id` | string | Unique post identifier |
| `post_url` | string | Direct URL to the post |
| `author_handle` | string | Author username/handle |
| `caption` | string | Post caption/text |
| `likes_count` | number | Likes/reactions |
| `comments_count` | number | Comments |
| `shares_count` | number | Shares |
| `views_count` | number | Views (Reels/video, when available) |
| `post_date` | string | When the post was published |
| `source` | string | The keyword/hashtag that found this post |
| `hashtags_list` | array | Hashtags used in the post |
| `image_urls` | array | URLs of post images |
| `top_comments` | array | Top comments (author + body) |
| `extracted_at` | string | ISO 8601 extraction timestamp |

#### Example output

```json
{
  "platform": "instagram",
  "post_id": "CxYz123456",
  "post_url": "https://www.instagram.com/p/CxYz123456",
  "author_handle": "@gadget_reviews",
  "caption": "This portable blender is a game-changer! 🔥 #viralproducts #amazonfinds",
  "likes_count": 12400,
  "comments_count": 328,
  "shares_count": 1540,
  "views_count": 89000,
  "post_date": "2026-03-01",
  "source": "viralproducts",
  "hashtags_list": ["viralproducts", "amazonfinds", "gadgets"],
  "image_urls": ["https://scontent.example.com/post_image.jpg"],
  "top_comments": [{ "author": "@jane", "body": "Need this!", "likes": 12 }],
  "extracted_at": "2026-03-06T14:30:00.000Z"
}
```

***

### 🔗 Integrations

Push results anywhere with the Apify platform's built-in integrations:

- **Webhooks** to trigger your own services when a run finishes
- **Zapier / Make** for no-code automation
- **Google Sheets / Drive, Slack, Airtable**
- **REST API** - fetch the dataset programmatically with one call

***

### 🤝 Related Actors

Building a wider social/e-commerce data pipeline? Pair this with other scrapers in the Apify Store for TikTok, YouTube, Amazon, and Google to enrich your dataset across channels.

***

### ❓ FAQ

**Do I need a Facebook or Instagram account?**
No - you can scrape public data with `loginFacebook` / `loginInstagram` set to `false`. Logging in can unlock richer data, but use a dedicated test account, never your personal one.

**Why am I getting few or no results?**
Facebook and Instagram aggressively block datacenter IPs. Enable **residential proxies** via `proxyConfiguration` for reliable results - this is the single biggest factor in success rate.

**Which platform should I choose?**
Use `"both"` for the widest coverage, or pick one to save time and cost.

**What formats can I export?**
JSON, CSV, Excel, HTML, RSS, or via the API - directly from the dataset tab.

**Can I run this on a schedule?**
Yes. Use Apify's **Schedules** to run the Actor hourly/daily and build an automatically updating dataset.

**Is scraping social media legal?**
Scraping publicly available data is generally permitted, but you are responsible for complying with each platform's Terms of Service and applicable laws (including GDPR/CCPA). Do not collect personal or sensitive data without a lawful basis. See the disclaimer below.

***

### ⚠️ Disclaimer

This Actor is intended for collecting **publicly available** information for legitimate purposes such as market research and analytics. You are solely responsible for how you use it and for compliance with Facebook's and Instagram's Terms of Service, robots.txt, and all applicable data-protection laws. Avoid scraping personal or sensitive data unless you have a lawful basis to do so.

### 🆘 Support & feedback

Found a bug, a broken selector, or want a new field added? **Open an issue on the Actor's Issues tab** - feedback is welcome and helps improve the Actor. Need a tailored or larger-scale solution? Reach out and we'll help.

***

### 🧰 Built with

- [Apify SDK](https://docs.apify.com/sdk/js/) - Actor framework, proxy, and dataset management
- [Playwright](https://playwright.dev/) - browser automation for Facebook and Instagram

# Actor input Schema

## `platforms` (type: `string`):

Which Meta platforms to scrape. Choose 'facebook', 'instagram', or 'both'.

## `searchKeywords` (type: `array`):

List of search keywords to scrape posts for. Each keyword will be searched on the selected platform(s).

## `hashtags` (type: `array`):

List of hashtags to scrape posts for (without the # symbol). Each hashtag will be searched on the selected platform(s).

## `postsPerQuery` (type: `integer`):

Maximum number of posts to scrape per keyword or hashtag.

## `fbEmail` (type: `string`):

Facebook account email for login. Required if scraping Facebook.

## `fbPassword` (type: `string`):

Facebook account password for login.

## `igUsername` (type: `string`):

Instagram account username for login. Required if scraping Instagram.

## `igPassword` (type: `string`):

Instagram account password for login.

## `loginFacebook` (type: `boolean`):

Whether to log in to Facebook before scraping. Disable if you want to scrape without authentication.

## `loginInstagram` (type: `boolean`):

Whether to log in to Instagram before scraping. Disable if you want to scrape without authentication.

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

Proxy settings. Facebook and Instagram block datacenter IPs, so RESIDENTIAL proxies are strongly recommended for reliable results. Requires a paid Apify proxy plan to use residential proxies.

## Actor input object example

```json
{
  "platforms": "both",
  "searchKeywords": [
    "trending products",
    "viral gadgets"
  ],
  "hashtags": [
    "trending",
    "viralproducts"
  ],
  "postsPerQuery": 15,
  "loginFacebook": true,
  "loginInstagram": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Dataset containing the scraped posts with captions, engagement metrics, and media URLs.

# 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 = {
    "searchKeywords": [
        "trending products",
        "viral gadgets"
    ],
    "hashtags": [
        "trending",
        "viralproducts"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("data_ops_main/meta-posts-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 = {
    "searchKeywords": [
        "trending products",
        "viral gadgets",
    ],
    "hashtags": [
        "trending",
        "viralproducts",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("data_ops_main/meta-posts-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 '{
  "searchKeywords": [
    "trending products",
    "viral gadgets"
  ],
  "hashtags": [
    "trending",
    "viralproducts"
  ]
}' |
apify call data_ops_main/meta-posts-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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