# LinkedIn Posts Scraper (`fetch_cat/linkedin-posts-scraper`) Actor

Extract public LinkedIn posts from direct post URLs and activity URNs with optional media and nested top-level comment previews.

- **URL**: https://apify.com/fetch\_cat/linkedin-posts-scraper.md
- **Developed by:** [Hanna Nosova](https://apify.com/fetch_cat) (community)
- **Categories:** Social media, Lead generation, Automation
- **Stats:** 7 total users, 3 monthly users, 79.1% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.21 / 1,000 post saveds

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/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 Posts Scraper for URLs and Activity URNs

Use this LinkedIn post scraper to export structured public posts from known post URLs or activity URNs. Receive exactly one normalized row per unique post with stable identity, author attribution, text, timestamps, media, links, and engagement.

Use this Actor for content analysis, campaign reporting, employer-brand monitoring, social-selling research, and content tracking. Enable the optional bounded top-level comments preview when a lightweight sample is enough; use the separate LinkedIn Post Comments Scraper for deep comments, replies, and pagination.

### Who is it for?

This Actor is built for marketing analysts, employer-brand teams, sales researchers, content operations teams, and developers who already have public LinkedIn post URLs and need structured records for reporting, monitoring, or integrations.

### Example input

```json
{
  "postUrls": [
    "https://www.linkedin.com/posts/linkedin_no-is-a-complete-sentence-activity-7247998907798978560-J_hB",
    "https://www.linkedin.com/posts/williamhgates_africa-decade-long-study-reveals-key-drivers-activity-7283949043293003776--eae"
  ],
  "postUrns": [],
  "maxPosts": 2,
  "includeMedia": true
}
```

### Example output

```json
{
  "postId": "7283949043293003776",
  "activityUrn": "urn:li:activity:7283949043293003776",
  "postUrl": "https://www.linkedin.com/posts/williamhgates_africa-decade-long-study-reveals-key-drivers-activity-7283949043293003776--eae",
  "canonicalUrl": "https://www.linkedin.com/posts/williamhgates_africa-decade-long-study-reveals-key-drivers-activity-7283949043293003776--eae",
  "postType": "article",
  "text": "Effective public health is about more than just the ‘what’—it’s about the ‘how.’ …",
  "textHtml": "Effective public health is about more than just the ‘what’…",
  "headline": "Effective public health is about more than just the ‘what’…",
  "publishedAt": "2025-01-11T20:53:01.122Z",
  "authorName": "Bill Gates",
  "authorUrl": "https://www.linkedin.com/in/williamhgates",
  "authorType": "Person",
  "authorImageUrl": "https://media.licdn.com/dms/image/...",
  "authorFollowerCount": 40561994,
  "authorHeadline": null,
  "images": [{ "url": "https://media.licdn.com/dms/image/...", "type": "image" }],
  "videos": [],
  "document": null,
  "article": { "title": "Africa: Decade-Long Study Reveals Key Drivers of Global Health Success", "url": null, "imageUrl": "https://media.licdn.com/dms/image/..." },
  "poll": null,
  "outboundLinks": [],
  "hashtags": [],
  "mentions": [{ "name": "Nadia Akseer", "url": "https://ca.linkedin.com/in/nadia-akseer-b897aa30" }],
  "taggedCompanies": [{ "name": "Exemplars in Global Health", "url": "https://www.linkedin.com/company/exemplars-in-global-health" }],
  "likeCount": 1706,
  "commentCount": 318,
  "repostCount": null,
  "reactionBreakdown": { "total": 1706 },
  "isRepost": false,
  "repost": null,
  "sourceInput": "https://www.linkedin.com/posts/...",
  "commentsPreview": [],
  "sourceStatus": "complete",
  "collectedAt": "2026-08-10T12:22:56.754Z"
}
```

### What data can you export?

| Field | Description |
|---|---|
| `postId` | Stable numeric LinkedIn activity ID |
| `activityUrn` | Normalized `urn:li:activity` value |
| `postUrl`, `canonicalUrl` | Public and canonical post URLs |
| `postType` | Normalized post or attachment type |
| `text`, `textHtml`, `headline` | Public post content and linked markup |
| `publishedAt` | Public post publication timestamp |
| `authorName`, `authorUrl`, `authorType` | Person or organization attribution |
| `authorImageUrl`, `authorFollowerCount`, `authorHeadline` | Public author metadata when exposed |
| `images`, `videos` | Public media metadata |
| `document`, `article`, `poll` | Structured attachment metadata when present |
| `outboundLinks` | Deduplicated non-identity links exposed by the post |
| `hashtags` | Hashtags found in public post text |
| `mentions`, `taggedCompanies` | Explicitly linked people and organizations |
| `likeCount`, `commentCount`, `repostCount` | Public engagement totals when exposed |
| `reactionBreakdown` | Public aggregate/reaction detail when exposed |
| `isRepost`, `repost` | Repost state and original-post detail when exposed |
| `sourceInput` | Original submitted post URL, activity URN, or numeric activity ID |
| `commentsPreview` | Optional nested top-level public comment sample; never separate dataset rows |
| `sourceStatus`, `collectedAt` | Completeness status and collection time |

Optional feature fields are empty or `null` when a public post does not contain or expose that feature. The Actor does not invent missing values.

### Input settings

| Key | Type | Default | Description |
|---|---|---:|---|
| `postUrls` | string\[] | one example post | Public LinkedIn post, share, or feed/update URLs |
| `postUrns` | string\[] | `[]` | Activity URNs or numeric activity IDs |
| `maxPosts` | integer | `20` | Maximum unique post rows across all targets, from 1 to 1000 |
| `includeMedia` | boolean | `true` | Include publicly exposed attachment metadata |
| `includeCommentsPreview` | boolean | `false` | Nest a lightweight top-level public comments preview |
| `maxPreviewComments` | integer | `5` | Preview cap per post, from 1 to 10; replies are not paginated |

At least one post URL, activity URN, or numeric activity ID is required. Duplicate activity IDs are processed once.

### Input recipes

#### Refresh a list of known posts

```json
{
  "postUrls": ["https://www.linkedin.com/posts/...-activity-7247998907798978560-..."],
  "maxPosts": 10,
  "includeMedia": true
}
```

#### Resolve activity URNs

```json
{
  "postUrns": ["urn:li:activity:7247998907798978560", "7283949043293003776"],
  "maxPosts": 2
}
```

### Pricing

This Actor uses pay-per-event pricing. A small start event covers run setup, and a result event is charged only after a post-detail row is saved. See the live [Pricing tab](https://apify.com/fetch_cat/linkedin-posts-scraper/pricing) for current rates and plan-tier discounts.

### Tips and limits

- Use stable activity URLs or URNs rather than copied redirect links when possible.
- Engagement totals are snapshots and can change between runs.
- LinkedIn may remove, restrict, or stop publicly rendering a post. Such inputs are reported as failures rather than fabricated empty rows.
- Only public post details are supported. Login-only, private, deleted, profile-search, comments, and reactor data are outside this Actor's scope.
- A mixed batch preserves valid rows when another supplied post fails.

### LinkedIn post API usage

```bash
curl -X POST "https://api.apify.com/v2/acts/fetch_cat~linkedin-posts-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"postUrns":["urn:li:activity:7247998907798978560"],"maxPosts":1}'
```

JavaScript:

```js
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('fetch_cat/linkedin-posts-scraper').call({
  postUrls: ['https://www.linkedin.com/posts/...-activity-7247998907798978560-...'],
  maxPosts: 1,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

Python:

```python
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ['APIFY_TOKEN'])
run = client.actor('fetch_cat/linkedin-posts-scraper').call(run_input={
    'postUrns': ['urn:li:activity:7247998907798978560'],
    'maxPosts': 1,
})
items = client.dataset(run['defaultDatasetId']).list_items().items
```

### Use with AI agents and MCP

Connect through [Apify MCP](https://mcp.apify.com/?tools=fetch_cat/linkedin-posts-scraper), then ask your agent to extract or refresh details for a list of public LinkedIn post URLs. Keep `maxPosts` small while testing a workflow.

### FAQ

#### What data can I export with a LinkedIn post scraper?

You can export 33 normalized fields covering post identity, author attribution, public text, publication time, media and attachment metadata, outbound links, engagement totals, and collection provenance.

#### Can I run LinkedIn Posts Scraper through an API, schedule, or MCP client?

Yes. Use the LinkedIn post API example above, create a recurring Actor schedule in Apify Console, or connect the Actor through Apify MCP for an AI-agent workflow.

#### How much does it cost to use LinkedIn Posts Scraper?

Runs charge a small start event plus one result event for each post-detail row saved. Current rates and plan discounts are always shown on the Actor's Pricing tab.

#### Does it require LinkedIn cookies or an account?

No. It processes details LinkedIn makes publicly visible for the supplied post.

#### Can it search for posts or scrape a profile or company post history?

No. This Actor resolves known public post URLs and activity URNs. Use a dedicated post-search or profile-post Actor when discovery is required.

#### Does it return comments or the people who reacted?

It can nest a small optional top-level comments preview in each post row. Deep comments, replies, and reactor records remain separate entity products.

#### Why is an attachment field null?

The post may not contain that attachment type, or LinkedIn may not expose it publicly. Null does not imply an extraction error when `sourceStatus` is `complete`.

### Related Actors

- [LinkedIn Jobs Scraper - Search & Export](https://apify.com/fetch_cat/linkedin-jobs-scraper)
- [LinkedIn Post Search Scraper](https://apify.com/fetch_cat/linkedin-post-search-scraper)
- [LinkedIn Company Scraper](https://apify.com/fetch_cat/linkedin-company-scraper)
- [LinkedIn Profile Scraper](https://apify.com/fetch_cat/linkedin-profile-scraper)
- [LinkedIn Company Search Scraper](https://apify.com/fetch_cat/linkedin-company-search-scraper)

### Support

Open an issue from the Actor page with a public example URL, run ID, expected result, and what was returned. Do not include private cookies, credentials, or non-public content.

# Actor input Schema

## `postUrls` (type: `array`):

Public LinkedIn post URLs.

## `postUrns` (type: `array`):

LinkedIn activity URNs or numeric activity IDs.

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

Maximum post rows across all targets.

## `includeMedia` (type: `boolean`):

Include public image and video URLs.

## `includeCommentsPreview` (type: `boolean`):

Nest a lightweight preview of top-level public comments in each post row. Disabled by default.

## `maxPreviewComments` (type: `integer`):

Maximum top-level preview comments nested per post. Replies are not paginated.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.linkedin.com/posts/linkedin_no-is-a-complete-sentence-activity-7247998907798978560-J_hB"
  ],
  "maxPosts": 20,
  "includeMedia": true,
  "includeCommentsPreview": false,
  "maxPreviewComments": 5
}
```

# 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 = {
    "postUrls": [
        "https://www.linkedin.com/posts/linkedin_no-is-a-complete-sentence-activity-7247998907798978560-J_hB"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("fetch_cat/linkedin-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 = { "postUrls": ["https://www.linkedin.com/posts/linkedin_no-is-a-complete-sentence-activity-7247998907798978560-J_hB"] }

# Run the Actor and wait for it to finish
run = client.actor("fetch_cat/linkedin-posts-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 '{
  "postUrls": [
    "https://www.linkedin.com/posts/linkedin_no-is-a-complete-sentence-activity-7247998907798978560-J_hB"
  ]
}' |
apify call fetch_cat/linkedin-posts-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fetch_cat/linkedin-posts-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/2MXDaxbi52gJtL1y6/builds/klqu0V8IUdQeZhalY/openapi.json
