# Search & Scrape Social Media Posts by Keyword (`mrscrap/search-scrape-social-media-posts-by-keyword`) Actor

Search any keyword and instantly scrape social media posts from TikTok, YouTube, Reddit, Instagram, Facebook, Twitter/X, and LinkedIn. Extracts likes, comments, and shares — no API keys needed. Filter by country, language, and date range.

- **URL**: https://apify.com/mrscrap/search-scrape-social-media-posts-by-keyword.md
- **Developed by:** [Mr Scrap](https://apify.com/mrscrap) (community)
- **Categories:** Social media, Automation, Integrations
- **Stats:** 2 total users, 1 monthly users, 66.7% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 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/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

## Social Media Post Scraper

**Instantly find out what social media is saying about any topic — across 7 major platforms.**

Want to know how people are reacting to a brand, a trend, or a keyword on TikTok, YouTube, Reddit, and more? This actor searches Google for the most relevant social media posts on your topic and extracts their engagement metrics (likes, comments, shares) — giving you a clear picture of the public conversation, without needing API keys or platform credentials.

---

### What You Get

- **Live engagement data** — likes, comments, and shares pulled directly from post pages
- **7 platforms in one run** — YouTube, Reddit, TikTok, Instagram, Facebook, Twitter/X, LinkedIn
- **Keyword-driven discovery** — find trending content for any topic, in any country or language
- **Structured output** — clean JSON dataset ready for analysis, reporting, or integration
- **Markdown report** — human-readable summary exported alongside your dataset

---

### Supported Platforms

| Platform | Likes | Comments | Shares | Reliability |
|----------|-------|----------|--------|-------------|
| YouTube | ✅ | ✅ | — | High (~90%) |
| Reddit | ✅ | ✅ | — | High (~90%) |
| TikTok | ⚠️ | ⚠️ | ⚠️ | Medium (~50%) — anti-bot risk |
| Instagram | ⚠️ | — | — | Low (<20%) — login wall |
| Facebook | ⚠️ | ⚠️ | ⚠️ | Low (<20%) — login wall |
| Twitter / X | ⚠️ | ⚠️ | ⚠️ | Low (<30%) — soft login wall |
| LinkedIn | — | — | — | Very low — login required |

> On login-protected platforms, engagement data is extracted from Google's search snippets when direct access is blocked.
> The `source` field in the output indicates whether data came from `"post_page"` (live) or `"google"` (snippet fallback).

---

### Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `keyword` | string | **YES** | — | Topic to search (e.g. `"AI tools USA"`) |
| `platforms` | array | no | all 7 | Platforms to include |
| `country` | string | no | `"us"` | Google country code (e.g. `"fr"`, `"ma"`) |
| `language` | string | no | `""` | Google language code (e.g. `"fr"`, `"ar"`) |
| `date_range` | enum | no | `"week"` | `hour` / `day` / `week` / `month` / `year` |
| `max_results_per_platform` | integer | no | `5` | Posts per platform (1–20) |
| `scrape_post_pages` | boolean | no | `true` | Fetch live metrics from post pages |
| `concurrency` | integer | no | `10` | Parallel requests (1–10) |

---

### Output

One item per post in your Apify dataset:

```json
{
  "keyword": "AI tools USA",
  "platform": "youtube",
  "title": "Best AI Tools For Developers In USA | 2024",
  "url": "https://youtube.com/watch?v=abc123",
  "likes": "14231",
  "comments": "847",
  "shares": "—",
  "source": "post_page"
}
````

A local Markdown report is also saved to `results/report_*.md` at the end of each run.

***

### Use Cases

- **Social media monitoring** — track what content performs best on your topic
- **Competitor research** — see which posts drive the most engagement in your niche
- **Content strategy** — identify trending formats and topics before creating content
- **Market research** — analyze public sentiment and content trends by country/language

# Actor input Schema

## `keyword` (type: `string`):

Topic or phrase to search for (e.g. 'AI tools Morocco 2024')

## `platforms` (type: `array`):

Which platforms to search. Leave empty to search all 7 platforms.

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

Google country for geotargeted results.

## `language` (type: `string`):

Language of Google search results. Select 'Any language' to get results in all languages.

## `date_range` (type: `string`):

How recent the Google results must be

## `max_results_per_platform` (type: `integer`):

Maximum number of posts to extract per platform (1–20). Each post = one dataset item.

## `scrape_post_pages` (type: `boolean`):

Visit each post URL to extract live engagement counts. If false, only Google snippet data is used (faster but less accurate for some platforms).

## `concurrency` (type: `integer`):

Number of parallel post-page crawls (1–10). Lower values are safer on anti-bot platforms.

## Actor input object example

```json
{
  "platforms": [
    "tiktok",
    "instagram",
    "youtube",
    "facebook",
    "twitter",
    "linkedin",
    "reddit"
  ],
  "country": "us",
  "language": "",
  "date_range": "week",
  "max_results_per_platform": 5,
  "scrape_post_pages": true,
  "concurrency": 10
}
```

# Actor output Schema

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

Dataset of social media posts with likes, comments, shares, and source platform.

# 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("mrscrap/search-scrape-social-media-posts-by-keyword").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("mrscrap/search-scrape-social-media-posts-by-keyword").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 mrscrap/search-scrape-social-media-posts-by-keyword --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=mrscrap/search-scrape-social-media-posts-by-keyword",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Search & Scrape Social Media Posts by Keyword",
        "description": "Search any keyword and instantly scrape social media posts from TikTok, YouTube, Reddit, Instagram, Facebook, Twitter/X, and LinkedIn. Extracts likes, comments, and shares — no API keys needed. Filter by country, language, and date range.",
        "version": "0.0",
        "x-build-id": "VWTb1pam7ljXo1Aha"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/mrscrap~search-scrape-social-media-posts-by-keyword/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-mrscrap-search-scrape-social-media-posts-by-keyword",
                "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/mrscrap~search-scrape-social-media-posts-by-keyword/runs": {
            "post": {
                "operationId": "runs-sync-mrscrap-search-scrape-social-media-posts-by-keyword",
                "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/mrscrap~search-scrape-social-media-posts-by-keyword/run-sync": {
            "post": {
                "operationId": "run-sync-mrscrap-search-scrape-social-media-posts-by-keyword",
                "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",
                "required": [
                    "keyword"
                ],
                "properties": {
                    "keyword": {
                        "title": "Search keyword",
                        "type": "string",
                        "description": "Topic or phrase to search for (e.g. 'AI tools Morocco 2024')"
                    },
                    "platforms": {
                        "title": "Social media platforms",
                        "type": "array",
                        "description": "Which platforms to search. Leave empty to search all 7 platforms.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "tiktok",
                                "instagram",
                                "youtube",
                                "facebook",
                                "twitter",
                                "linkedin",
                                "reddit"
                            ],
                            "enumTitles": [
                                "TikTok",
                                "Instagram",
                                "YouTube",
                                "Facebook",
                                "Twitter / X",
                                "LinkedIn",
                                "Reddit"
                            ]
                        },
                        "default": [
                            "tiktok",
                            "instagram",
                            "youtube",
                            "facebook",
                            "twitter",
                            "linkedin",
                            "reddit"
                        ]
                    },
                    "country": {
                        "title": "Country",
                        "enum": [
                            "us",
                            "gb",
                            "fr",
                            "de",
                            "es",
                            "it",
                            "pt",
                            "br",
                            "ca",
                            "au",
                            "nz",
                            "ma",
                            "dz",
                            "tn",
                            "ly",
                            "eg",
                            "sa",
                            "ae",
                            "qa",
                            "kw",
                            "bh",
                            "om",
                            "jo",
                            "lb",
                            "iq",
                            "sy",
                            "ye",
                            "tr",
                            "ir",
                            "pk",
                            "in",
                            "bd",
                            "lk",
                            "np",
                            "ng",
                            "gh",
                            "ke",
                            "za",
                            "sn",
                            "ci",
                            "cm",
                            "et",
                            "tz",
                            "ug",
                            "ao",
                            "mz",
                            "ru",
                            "pl",
                            "ua",
                            "cz",
                            "hu",
                            "ro",
                            "bg",
                            "rs",
                            "hr",
                            "sk",
                            "si",
                            "at",
                            "ch",
                            "be",
                            "nl",
                            "se",
                            "no",
                            "dk",
                            "fi",
                            "gr",
                            "il",
                            "jp",
                            "kr",
                            "cn",
                            "tw",
                            "hk",
                            "sg",
                            "my",
                            "id",
                            "th",
                            "vn",
                            "ph",
                            "mm",
                            "mx",
                            "ar",
                            "co",
                            "cl",
                            "pe",
                            "ve",
                            "ec",
                            "bo",
                            "py",
                            "uy"
                        ],
                        "type": "string",
                        "description": "Google country for geotargeted results.",
                        "default": "us"
                    },
                    "language": {
                        "title": "Language",
                        "enum": [
                            "",
                            "en",
                            "fr",
                            "ar",
                            "es",
                            "de",
                            "it",
                            "pt",
                            "nl",
                            "ru",
                            "pl",
                            "uk",
                            "cs",
                            "hu",
                            "ro",
                            "bg",
                            "hr",
                            "sk",
                            "sl",
                            "el",
                            "sv",
                            "no",
                            "da",
                            "fi",
                            "tr",
                            "he",
                            "fa",
                            "hi",
                            "ur",
                            "bn",
                            "ta",
                            "te",
                            "mr",
                            "gu",
                            "kn",
                            "ml",
                            "pa",
                            "id",
                            "ms",
                            "th",
                            "vi",
                            "tl",
                            "ja",
                            "ko",
                            "zh-CN",
                            "zh-TW",
                            "my",
                            "km",
                            "lo",
                            "si",
                            "sw",
                            "am",
                            "ha",
                            "yo",
                            "ig",
                            "zu",
                            "af",
                            "so"
                        ],
                        "type": "string",
                        "description": "Language of Google search results. Select 'Any language' to get results in all languages.",
                        "default": ""
                    },
                    "date_range": {
                        "title": "Date range",
                        "enum": [
                            "",
                            "hour",
                            "day",
                            "week",
                            "month",
                            "year"
                        ],
                        "type": "string",
                        "description": "How recent the Google results must be",
                        "default": "week"
                    },
                    "max_results_per_platform": {
                        "title": "Max results per platform",
                        "minimum": 1,
                        "maximum": 20,
                        "type": "integer",
                        "description": "Maximum number of posts to extract per platform (1–20). Each post = one dataset item.",
                        "default": 5
                    },
                    "scrape_post_pages": {
                        "title": "Scrape post pages for live metrics",
                        "type": "boolean",
                        "description": "Visit each post URL to extract live engagement counts. If false, only Google snippet data is used (faster but less accurate for some platforms).",
                        "default": true
                    },
                    "concurrency": {
                        "title": "Concurrency",
                        "minimum": 1,
                        "maximum": 10,
                        "type": "integer",
                        "description": "Number of parallel post-page crawls (1–10). Lower values are safer on anti-bot platforms.",
                        "default": 10
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
