# LinkedIn Post Search Scraper | Extract by Keyword (`benjarapi/linkedin-post-search`) Actor

Scrape LinkedIn posts directly from search results. Input a keyword or search URL to extract paginated post data and authors for easy analysis.

- **URL**: https://apify.com/benjarapi/linkedin-post-search.md
- **Developed by:** [Benjar Scraping API](https://apify.com/benjarapi) (community)
- **Categories:** Lead generation, Social media, Automation
- **Stats:** 541 total users, 48 monthly users, 100.0% runs succeeded, 10 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $3.00 / 1,000 posts

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?

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

## LinkedIn Post Search Scraper

The ultimate **LinkedIn Post Scraper** and **Search Extractor** on Apify.
Scrape and extract LinkedIn posts in bulk using keywords, LinkedIn search URLs, or specific filters. Extract full post text, reactions, comments, reposts, media attachments, and author details — all structured, paginated, and ready for analysis.

### Why Use This LinkedIn Post Scraper?

- **Bulk extraction** — Collect thousands of LinkedIn posts from any search query in a single run.
- **Rich structured data** — Get post text, timestamps, engagement stats (likes, comments, reposts), author info, and attached media.
- **Advanced Flexible Input** — Search by keywords, pass a full LinkedIn search URL, or use advanced filters like content type, date posted, author industry, and more.
- **Automatic Pagination** — No manual scrolling or page handling; the scraper fetches all posts up to your specified limit automatically.
- **Export-ready** — Download extracted LinkedIn posts as JSON, CSV, Excel, XML, or any format supported by Apify.

### Input: How to Scrape LinkedIn Posts

You can configure the actor to scrape posts using either keywords, a LinkedIn search URL, or specific filters.

#### Search Parameters

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `keywords` | string | No\* | — | Keywords to search for in LinkedIn posts |
| `searchUrl` | string | No\* | — | Full LinkedIn search URL. Overrides keywords, filters, and sort options if provided |
| `maxPosts` | integer | No | `100` | Maximum number of posts to collect |
| `profileScrapingMode` | string | No | `short` | Author data detail level: `short` (basic info from search results) or `main` (full profile/company scrape for each author) |

\* At least one of `keywords` or `searchUrl` must be provided.

#### Filters & Sort Options

Refine your LinkedIn post search with these advanced filters:

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `sortBy` | string | `relevance` | Sort order: `relevance` (Top match) or `date_posted` (Latest) |
| `datePosted` | string | — | `past-24h`, `past-week`, or `past-month` |
| `contentType` | string | — | `videos`, `photos`, `jobs`, `liveVideos`, `articles`, `documents`, `collaborativeArticles` |
| `fromMember` | string\[] | — | Filter by specific member IDs |
| `fromOrganization` | string\[] | — | Filter by specific company/organization IDs |
| `mentionsMember` | string\[] | — | Filter by mentioned member IDs |
| `mentionsOrganization` | string\[] | — | Filter by mentioned company/organization IDs |
| `authorIndustry` | string\[] | — | Filter by author's industry IDs |
| `authorCompany` | string\[] | — | Filter by author's company IDs |
| `authorJobTitle` | string | — | Filter by author's job title keywords |

### Usage Examples

#### 1. Search LinkedIn Posts by Keywords with Filters

```json
{
    "keywords": "machine learning",
    "maxPosts": 50,
    "sortBy": "date_posted",
    "datePosted": "past-week"
}
```

#### 2. Scrape Posts Using a LinkedIn Search URL

```json
{
    "searchUrl": "https://www.linkedin.com/search/results/content/?keywords=nodejs&sortBy=date_posted",
    "maxPosts": 200
}
```

### Output — LinkedIn Post Data Structure

The scraper produces a dataset where each item is a detailed LinkedIn post structure:

| Field | Type | Description |
|-------|------|-------------|
| `urn` | object | LinkedIn URNs for the post (`activity_urn`, `share_urn`, `ugcPost_urn`) |
| `full_urn` | string | Full LinkedIn activity URN identifier |
| `posted_at` | object | Post date and time — includes `date` (ISO format), `relative` (human-readable), and `timestamp` (Unix ms) |
| `text` | string | Full text content of the LinkedIn post |
| `url` | string | Direct permalink to the post on LinkedIn |
| `post_type` | string | Type of post (e.g. `regular`) |
| `author` | object | Author details — `first_name`, `last_name`, `headline`, `username`, `profile_url`, `profile_picture` |
| `stats` | object | Engagement metrics — `total_reactions`, `like`, `support`, `love`, `insight`, `celebrate`, `funny`, `comments`, `reposts` |
| `media` | object | null | Attached media — `type` (`video`, `image`, etc.), `url`, `thumbnail`. `null` if no media is attached |

#### Sample Output Data

```json
[
    {
        "urn": {
            "activity_urn": "7420485585376620544",
            "share_urn": null,
            "ugcPost_urn": "7420485424273416192"
        },
        "full_urn": "urn:li:activity:7420485585376620544",
        "posted_at": {
            "date": "2026-01-29 11:54:39",
            "relative": "1 week ago • Visible to anyone on or off LinkedIn",
            "timestamp": 1769687679069
        },
        "text": "So much of dev work happens in the context of a larger team...",
        "url": "https://www.linkedin.com/posts/...",
        "post_type": "regular",
        "author": {
            "first_name": "Satya",
            "last_name": "Nadella",
            "headline": "Chairman and CEO at Microsoft",
            "username": "satyanadella",
            "profile_url": "https://www.linkedin.com/in/satyanadella",
            "profile_picture": "https://media.licdn.com/dms/image/..."
        },
        "stats": {
            "total_reactions": 1749,
            "like": 1518,
            "support": 13,
            "love": 50,
            "insight": 83,
            "celebrate": 82,
            "funny": 3,
            "comments": 154,
            "reposts": 174
        },
        "media": {
            "type": "video",
            "url": "https://dms.licdn.com/playlist/vid/...",
            "thumbnail": "https://media.licdn.com/dms/image/..."
        }
    }
]
```

### Top Use Cases for LinkedIn Post Scraper Tool

- **LinkedIn Content Analysis & Strategy** — Analyze posting frequency, popular topics, and content strategies of industry leaders, influencers, or competitors.
- **Engagement Benchmarking** — Compare LinkedIn reaction counts, comment rates, and repost ratios across specific keywords to benchmark social media performance and ROI.
- **B2B Lead Generation** — Identify and extract prospects who actively post about specific topics, tools, or industries on LinkedIn, empowering targeted outreach.
- **Social Listening & Trend Tracking** — Monitor what key voices in your industry are discussing to spot emerging trends, pain points, and market shifts early.
- **Sentiment Analysis & Natural Language Processing (NLP)** — Feed scraped LinkedIn post datasets into NLP pipelines to gauge public sentiment around specific brands, products, or events.
- **Influencer Research & Discovery** — Evaluate potential LinkedIn influencer partnerships by efficiently analyzing their historical content output, engagement metrics, and audience reach.
- **Competitive Intelligence** — Track how competitor executives and companies communicate product launches, strategy shifts, or hiring activity directly on their LinkedIn feeds.
- **AI & ML Training Data Collection** — Build high-quality datasets of professional, industry-specific text content for fine-tuning Large Language Models (LLMs) and custom AI applications.

# Actor input Schema

## `keywords` (type: `string`):

Keywords to search for in LinkedIn posts (e.g. "nodejs", "machine learning")

## `searchUrl` (type: `string`):

Full LinkedIn search URL. If provided, keywords, filters, and sort options will be extracted from this URL, overriding manual inputs.

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

Maximum number of posts to collect from search results

## `profileScrapingMode` (type: `string`):

Author data detail level. 'short' returns basic info from search results. 'main' performs a full profile/company scrape for each post author (charges extra).

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

Sort order for search results

## `datePosted` (type: `string`):

Filter posts by when they were posted

## `contentType` (type: `string`):

Filter posts by content type

## `fromMember` (type: `array`):

Filter posts by specific member IDs (LinkedIn member URN IDs)

## `fromOrganization` (type: `array`):

Filter posts by specific company/organization IDs

## `mentionsMember` (type: `array`):

Filter posts mentioning specific member IDs

## `mentionsOrganization` (type: `array`):

Filter posts mentioning specific company/organization IDs

## `authorIndustry` (type: `array`):

Filter posts by author's industry IDs

## `authorCompany` (type: `array`):

Filter posts by author's company IDs

## `authorJobTitle` (type: `string`):

Filter posts by author's job title keywords

## Actor input object example

```json
{
  "keywords": "SaaS GTM Strategy OR Founder-led marketing",
  "maxPosts": 100,
  "profileScrapingMode": "short",
  "sortBy": "relevance",
  "fromMember": [],
  "fromOrganization": [],
  "mentionsMember": [],
  "mentionsOrganization": [],
  "authorIndustry": [],
  "authorCompany": []
}
```

# 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 = {
    "keywords": "SaaS GTM Strategy OR Founder-led marketing",
    "searchUrl": "",
    "maxPosts": 100,
    "profileScrapingMode": "short",
    "sortBy": "relevance",
    "datePosted": "",
    "contentType": "",
    "fromMember": [],
    "fromOrganization": [],
    "mentionsMember": [],
    "mentionsOrganization": [],
    "authorIndustry": [],
    "authorCompany": [],
    "authorJobTitle": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("benjarapi/linkedin-post-search").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 = {
    "keywords": "SaaS GTM Strategy OR Founder-led marketing",
    "searchUrl": "",
    "maxPosts": 100,
    "profileScrapingMode": "short",
    "sortBy": "relevance",
    "datePosted": "",
    "contentType": "",
    "fromMember": [],
    "fromOrganization": [],
    "mentionsMember": [],
    "mentionsOrganization": [],
    "authorIndustry": [],
    "authorCompany": [],
    "authorJobTitle": "",
}

# Run the Actor and wait for it to finish
run = client.actor("benjarapi/linkedin-post-search").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 '{
  "keywords": "SaaS GTM Strategy OR Founder-led marketing",
  "searchUrl": "",
  "maxPosts": 100,
  "profileScrapingMode": "short",
  "sortBy": "relevance",
  "datePosted": "",
  "contentType": "",
  "fromMember": [],
  "fromOrganization": [],
  "mentionsMember": [],
  "mentionsOrganization": [],
  "authorIndustry": [],
  "authorCompany": [],
  "authorJobTitle": ""
}' |
apify call benjarapi/linkedin-post-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,benjarapi/linkedin-post-search"
        }
    }
}

```

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/n5loJujJAN74AlniA/builds/yC4VGwJcw6GCxl1ku/openapi.json
