# AI Linkedin Post Scraper (`alizarin_refrigerator-owner/linkedin-post-scraper`) Actor

Scrape viral/trending LinkedIn posts by hashtag or keyword search. Perfect for finding content inspiration and building a library of top-performing posts in your niche. Get top posts from any LinkedIn hashtag. Find posts matching specific keywords. Output formatted for AI voice analysis

- **URL**: https://apify.com/alizarin\_refrigerator-owner/linkedin-post-scraper.md
- **Developed by:** [John Rippy](https://apify.com/alizarin_refrigerator-owner) (community)
- **Categories:** AI, Social media, Lead generation
- **Stats:** 4 total users, 3 monthly users, 14.3% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

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

## LinkedIn Post Scraper

Scrape viral/trending LinkedIn posts by hashtag or keyword search. Perfect for finding content inspiration and building a library of top-performing posts in your niche.

### Features

- **Hashtag Scraping**: Get top posts from any LinkedIn hashtag
- **Keyword Search**: Find posts matching specific keywords
- **Engagement Filtering**: Only get posts above your engagement thresholds
- **Author Info**: Optionally includes author's followers and headline
- **Voice Training Ready**: Output formatted for AI voice analysis

### Use Cases

1. **Content Inspiration**: Find what's working in your niche
2. **Trend Research**: Track trending topics and formats
3. **Voice Training**: Collect diverse writing styles for AI training
4. **Competitor Analysis**: See what content performs best

### Input

```json
{
  "searchType": "hashtag",
  "hashtags": ["leadership", "marketing", "AI"],
  "cookies": "[{\"name\":\"li_at\", ...}]",
  "maxPostsPerSource": 50,
  "minLikes": 100,
  "minComments": 10,
  "sortBy": "top",
  "timeFilter": "past_week",
  "includeAuthorInfo": true
}
````

#### Getting LinkedIn Cookies (Required)

If you have **Multi-Factor Authentication (MFA/2FA) enabled** on your LinkedIn account, you **must use cookies** - there's no alternative login method.

**Step 1:** Install a cookie export extension:

- **[Cookie-Editor](https://cookie-editor.com/)** by [Moustachauve](https://github.com/Moustachauve/cookie-editor) - Clean interface, supports Chrome/Firefox/Edge/Safari
- **[EditThisCookie](http://www.editthiscookie.com/)** by [Francesco Capano](https://github.com/ETCExtensions/Edit-This-Cookie) - Chrome extension, classic choice

**Step 2:** Log into LinkedIn in your browser

**Step 3:** Click the cookie extension icon, then:

- **Cookie-Editor:** Click "Export" → "Export as JSON"
- **EditThisCookie:** Click the export button (looks like ↓)

**Step 4:** Paste the JSON array into the "cookies" field

The most important cookie is `li_at` - this is your LinkedIn session token.

### Output

```json
{
  "posts": [
    {
      "id": "123",
      "url": "https://linkedin.com/feed/update/...",
      "text": "Post content...",
      "likes": 1523,
      "comments": 234,
      "reposts": 89,
      "postedAt": "2025-12-15T10:00:00Z",
      "hashtags": ["leadership", "growth"],
      "author": {
        "name": "John Doe",
        "headline": "CEO at Company",
        "profileUrl": "https://linkedin.com/in/johndoe",
        "followers": 50000
      },
      "hasImage": true,
      "hasVideo": false,
      "hasCarousel": false,
      "hasDocument": true
    }
  ],
  "stats": {
    "totalPosts": 150,
    "avgLikes": 523,
    "avgComments": 45,
    "topAuthors": ["John Doe", "Jane Smith"],
    "topHashtags": ["leadership", "growth", "mindset"]
  }
}
```

### Pricing

This actor uses **pay-per-event** pricing:

| Event | Description | Price |
|-------|-------------|-------|
| `apify-actor-start` | Base cost per run | $0.10 |
| `post_scraped` | Per post scraped | $0.02 |
| `author_scraped` | Per author profile (if includeAuthorInfo) | $0.01 |

**Example costs:**

- 50 posts basic: $0.10 + (50 × $0.02) = **$1.10**
- 50 posts with author info: $0.10 + (50 × $0.02) + (50 × $0.01) = **$1.60**
- 100 posts with author info: $0.10 + (100 × $0.02) + (100 × $0.01) = **$3.10**

***

**Built by [John Rippy](https://www.linkedin.com/in/johnrippy/)** | [johnrippy.link](https://johnrippy.link/)

***

### Keywords

linkedin post scraper, linkedin content scraper, linkedin data extraction, linkedin api, social media scraper, linkedin posts

# Actor input Schema

## `searchType` (type: `string`):

How to find posts. 'auto' (RECOMMENDED) uses multiple methods with residential proxies - no cookies needed! 'google\_search' finds indexed posts via Google. Other modes require LinkedIn cookies.

## `profileUrl` (type: `string`):

LinkedIn profile URL to scrape posts from. Example: https://www.linkedin.com/in/johnrippy/

## `profileUsername` (type: `string`):

LinkedIn username (the part after /in/ in the URL). Example: johnrippy

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

Hashtags to scrape posts from (e.g., leadership, marketing, AI)

## `keywords` (type: `array`):

Keywords to search for in posts

## `cookies` (type: `string`):

JSON string of LinkedIn cookies for authentication

## `linkedinEmail` (type: `string`):

LinkedIn account email for automatic login (optional - enables authenticated scraping without manual cookie extraction)

## `linkedinPassword` (type: `string`):

LinkedIn account password for automatic login

## `maxPostsPerSource` (type: `integer`):

Maximum posts to scrape per hashtag/keyword

## `minLikes` (type: `integer`):

Only include posts with at least this many likes (filters for viral content)

## `minComments` (type: `integer`):

Only include posts with at least this many comments

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

How to sort/filter posts

## `timeFilter` (type: `string`):

Only get posts from this time period

## `includeAuthorInfo` (type: `boolean`):

Also scrape author's profile info (followers, headline)

## `proxy` (type: `object`):

Proxy settings

## `demoMode` (type: `boolean`):

Return mock data for testing

## `webhookUrl` (type: `string`):

URL to POST results when scraping completes (Zapier, Make, n8n, custom endpoint)

## Actor input object example

```json
{
  "searchType": "auto",
  "hashtags": [
    "leadership",
    "marketing"
  ],
  "maxPostsPerSource": 50,
  "minLikes": 100,
  "minComments": 10,
  "sortBy": "top",
  "timeFilter": "past_week",
  "includeAuthorInfo": true,
  "demoMode": false
}
```

# 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 = {
    "hashtags": [
        "leadership",
        "marketing"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("alizarin_refrigerator-owner/linkedin-post-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 = { "hashtags": [
        "leadership",
        "marketing",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("alizarin_refrigerator-owner/linkedin-post-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 '{
  "hashtags": [
    "leadership",
    "marketing"
  ]
}' |
apify call alizarin_refrigerator-owner/linkedin-post-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "AI Linkedin Post Scraper",
        "description": "Scrape viral/trending LinkedIn posts by hashtag or keyword search. Perfect for finding content inspiration and building a library of top-performing posts in your niche. Get top posts from any LinkedIn hashtag. Find posts matching specific keywords. Output formatted for AI voice analysis",
        "version": "1.0",
        "x-build-id": "dkrvEqZtTXFbQFJ5M"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/alizarin_refrigerator-owner~linkedin-post-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-alizarin_refrigerator-owner-linkedin-post-scraper",
                "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/alizarin_refrigerator-owner~linkedin-post-scraper/runs": {
            "post": {
                "operationId": "runs-sync-alizarin_refrigerator-owner-linkedin-post-scraper",
                "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/alizarin_refrigerator-owner~linkedin-post-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-alizarin_refrigerator-owner-linkedin-post-scraper",
                "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",
                "properties": {
                    "searchType": {
                        "title": "Search Type",
                        "enum": [
                            "auto",
                            "google_search",
                            "hashtag",
                            "keyword",
                            "feed",
                            "profile"
                        ],
                        "type": "string",
                        "description": "How to find posts. 'auto' (RECOMMENDED) uses multiple methods with residential proxies - no cookies needed! 'google_search' finds indexed posts via Google. Other modes require LinkedIn cookies.",
                        "default": "auto"
                    },
                    "profileUrl": {
                        "title": "LinkedIn Profile URL",
                        "type": "string",
                        "description": "LinkedIn profile URL to scrape posts from. Example: https://www.linkedin.com/in/johnrippy/"
                    },
                    "profileUsername": {
                        "title": "LinkedIn Username",
                        "type": "string",
                        "description": "LinkedIn username (the part after /in/ in the URL). Example: johnrippy"
                    },
                    "hashtags": {
                        "title": "Hashtags",
                        "type": "array",
                        "description": "Hashtags to scrape posts from (e.g., leadership, marketing, AI)",
                        "items": {
                            "type": "string"
                        }
                    },
                    "keywords": {
                        "title": "Search Keywords",
                        "type": "array",
                        "description": "Keywords to search for in posts",
                        "items": {
                            "type": "string"
                        }
                    },
                    "cookies": {
                        "title": "LinkedIn Cookies",
                        "type": "string",
                        "description": "JSON string of LinkedIn cookies for authentication"
                    },
                    "linkedinEmail": {
                        "title": "LinkedIn Email",
                        "type": "string",
                        "description": "LinkedIn account email for automatic login (optional - enables authenticated scraping without manual cookie extraction)"
                    },
                    "linkedinPassword": {
                        "title": "LinkedIn Password",
                        "type": "string",
                        "description": "LinkedIn account password for automatic login"
                    },
                    "maxPostsPerSource": {
                        "title": "Max Posts Per Source",
                        "minimum": 10,
                        "maximum": 200,
                        "type": "integer",
                        "description": "Maximum posts to scrape per hashtag/keyword",
                        "default": 50
                    },
                    "minLikes": {
                        "title": "Minimum Likes",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only include posts with at least this many likes (filters for viral content)",
                        "default": 100
                    },
                    "minComments": {
                        "title": "Minimum Comments",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only include posts with at least this many comments",
                        "default": 10
                    },
                    "sortBy": {
                        "title": "Sort By",
                        "enum": [
                            "recent",
                            "top"
                        ],
                        "type": "string",
                        "description": "How to sort/filter posts",
                        "default": "top"
                    },
                    "timeFilter": {
                        "title": "Time Filter",
                        "enum": [
                            "past_24h",
                            "past_week",
                            "past_month",
                            "any"
                        ],
                        "type": "string",
                        "description": "Only get posts from this time period",
                        "default": "past_week"
                    },
                    "includeAuthorInfo": {
                        "title": "Include Author Info",
                        "type": "boolean",
                        "description": "Also scrape author's profile info (followers, headline)",
                        "default": true
                    },
                    "proxy": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Proxy settings"
                    },
                    "demoMode": {
                        "title": "Demo Mode",
                        "type": "boolean",
                        "description": "Return mock data for testing",
                        "default": false
                    },
                    "webhookUrl": {
                        "title": "Webhook URL",
                        "type": "string",
                        "description": "URL to POST results when scraping completes (Zapier, Make, n8n, custom endpoint)"
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
