# LinkedIn Post Comments Mass scraper (`jobscrawler/linkedin-post-comments`) Actor

Extract LinkedIn post comments, scrape comments or replies to comments as well as comment social activities such as likes and reactions without compromising security or violating platform policies.

- **URL**: https://apify.com/jobscrawler/linkedin-post-comments.md
- **Developed by:** [Jobs Scraper](https://apify.com/jobscrawler) (community)
- **Categories:** Social media, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## LinkedIn Post Comments Mass scraper

Our powerful tool helps you extract LinkedIn post comments, scrape comments or replies to comments as well as comment social activities such as likes and reactions without compromising security or violating platform policies. It is very helpful for engagement analysis and outreach purposes.

### Key Benefits

- **No cookies or account required**: Access comments data without sharing cookies or risking account restrictions
- **Low pricing**: $2 per 1k comments.
- **Fast response times**: Deliver data in seconds 🚀
- **No caching**: Fresh real-time data on demand.

***

### How It Works

#### (Required) List of Post URLs or post comments URL to scrape (`posts`):

- When a **post URL** is provided, the actor will scrape all comments under the post. It will also collect up to 5 replies to comments nested inside comments. Note that the total count of results will count root comments and replies according to your input configuration.
- When a **post comment URL** is provided, the actor will scrape only that specific comment with nested replies. If you enable `scrapeReplies`, replies will be counted as separate results.

#### Other Parameters (Optional):

- `maxItems`: Maximum number of comments to scrape per each post. If set to 0, it will scrape all available pages per post.
- `postedLimit`: Limit comments to those posted within a certain timeframe. Supported values: `any`, `24h`, `week`, `month`, `3months`, `6months`, `year`. Default is `any`.
- `scrapeReplies`: Whether to scrape replies to comments.
- `profileScraperMode`: Set this to `short` for basic author info or `main` to enrich comment actors with main profile data (position, profile picture, etc.).

***

### Data You'll Receive

- **Comment URL** (`linkedinUrl`)
- **Comment text** (`commentary`)
- **Number of replies, likes, shares, impressions** (`numComments`, `numShares`, `numImpressions`)
- **Reaction type counts** (`reactionTypeCounts`: like, love, insightful, etc.)
- **Actor's name** (`actor.name`)
- **Actor's LinkedIn URL** (`actor.linkedinUrl`)
- **Actor's position** (`actor.position`)
- **Actor's profile picture URL** (`actor.pictureUrl`)
- **Comment creation date** (`createdAt` and `createdAtTimestamp`)
- **Post ID** (`postId`)

***

### ⬇️ Input Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `posts` | array | Required | List of LinkedIn post URLs or post comment URLs to scrape |
| `maxItems` | integer | Optional | Maximum number of comments to scrape per post (default: 10, 0 = all) |
| `postedLimit` | string | Optional | Timeframe filter: `any`, `24h`, `week`, `month`, `3months`, `6months`, `year` |
| `scrapeReplies` | boolean | Optional | Whether to scrape replies to comments |
| `profileScraperMode` | string | Optional | `short` (basic profile info) or `main` (enriched detailed profile info) |

#### Example Input JSON

```json
{
  "posts": [
    "https://www.linkedin.com/posts/microsoft-events_microsoft-build-has-arrived-in-seattle-and-ugcPost-7329991434395160578-GnK7?utm_source=share&utm_medium=member_desktop&rcm=ACoAACzazy4B3ajZsA0WxWr6m4S77iItYbYCLZM",
    "https://www.linkedin.com/feed/update/urn:li:activity:7320867199693246465/",
    "https://www.linkedin.com/feed/update/urn:li:ugcPost:7396563121059872768?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7396563121059872768%2C7396565439390076928%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287396565439390076928%2Curn%3Ali%3AugcPost%3A7396563121059872768%29"
  ],
  "maxItems": 10,
  "profileScraperMode": "short"
}
```

***

### ⬆️ Sample Output Data

```json
{
  "type": "comment",
  "id": "7331190065471078400",
  "linkedinUrl": "https://www.linkedin.com/feed/update/urn:li:activity:7328838056403173380?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7328838056403173380%2C7331190065471078400%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287331190065471078400%2Curn%3Ali%3Aactivity%3A7328838056403173380%29",
  "commentary": "❤️",
  "createdAt": "2025-05-22T05:31:58.534Z",
  "numComments": 0,
  "numShares": null,
  "numImpressions": null,
  "reactionTypeCounts": [
    {
      "type": "LIKE",
      "count": 1
    }
  ],
  "actor": {
    "id": "ACoAAFsE9LEBl7BKtsoGeoDZz0IvKfmiGgiEtX8",
    "name": "Leek Gai",
    "linkedinUrl": "https://www.linkedin.com/in/leek-gai-3a94a6367",
    "position": "Student at Bugema University",
    "pictureUrl": "https://media.licdn.com/dms/image/v2/D4D03AQFWtueH_5zHYQ/profile-displayphoto-shrink_800_800/B4DZb4IP4IG0Ac-/0/1747919636435?e=1753315200&v=beta&t=ykKTPu2Mkc6i9uyRaHXm8yziqM3dkd18zLaRQ8dCLdg",
    "picture": {
      "url": "https://media.licdn.com/dms/image/v2/D4D03AQFWtueH_5zHYQ/profile-displayphoto-shrink_800_800/B4DZb4IP4IG0Ac-/0/1747919636435?e=1753315200&v=beta&t=ykKTPu2Mkc6i9uyRaHXm8yziqM3dkd18zLaRQ8dCLdg",
      "width": 800,
      "height": 800,
      "expiresAt": 1753315200000
    },
    "author": false
  },
  "createdAtTimestamp": 1747891918534,
  "pinned": false,
  "contributed": false,
  "edited": false,
  "postId": "7328838056403173380"
}
```

***

### Linkedin Post Comment API

The actor stores results in an Apify dataset. You can export data in various formats such as CSV, JSON, XLS, etc. You can scrape and access data on demand using the API.

# Actor input Schema

## `posts` (type: `array`):

List of LinkedIn post URLs or post comments URLs to scrape.

## `maxItems` (type: `integer`):

Maximum number of comments to scrape per each post. If 0 or empty, scrapes all available comments.

## `postedLimit` (type: `string`):

Fetch comments no older than X timeframe. Options: any, 24h, week, month, 3months, 6months, year.

## `scrapeReplies` (type: `boolean`):

Whether to scrape replies to comments.

## `profileScraperMode` (type: `string`):

Choose mode for scraping profiles of comment authors. 'short' provides basic info, 'main' enriches author profile data.

## `connectionProxy` (type: `object`):

Apify proxy configuration. Residential recommended.

## Actor input object example

```json
{
  "posts": [
    "https://www.linkedin.com/posts/microsoft-events_microsoft-build-has-arrived-in-seattle-and-ugcPost-7329991434395160578-GnK7?utm_source=share&utm_medium=member_desktop&rcm=ACoAACzazy4B3ajZsA0WxWr6m4S77iItYbYCLZM",
    "https://www.linkedin.com/feed/update/urn:li:activity:7320867199693246465/",
    "https://www.linkedin.com/feed/update/urn:li:ugcPost:7396563121059872768?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7396563121059872768%2C7396565439390076928%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287396565439390076928%2Curn%3Ali%3AugcPost%3A7396563121059872768%29"
  ],
  "maxItems": 10,
  "postedLimit": "any",
  "scrapeReplies": false,
  "profileScraperMode": "short",
  "connectionProxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# 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 = {
    "posts": [
        "https://www.linkedin.com/posts/microsoft-events_microsoft-build-has-arrived-in-seattle-and-ugcPost-7329991434395160578-GnK7?utm_source=share&utm_medium=member_desktop&rcm=ACoAACzazy4B3ajZsA0WxWr6m4S77iItYbYCLZM",
        "https://www.linkedin.com/feed/update/urn:li:activity:7320867199693246465/",
        "https://www.linkedin.com/feed/update/urn:li:ugcPost:7396563121059872768?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7396563121059872768%2C7396565439390076928%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287396565439390076928%2Curn%3Ali%3AugcPost%3A7396563121059872768%29"
    ],
    "maxItems": 10,
    "postedLimit": "any",
    "profileScraperMode": "short"
};

// Run the Actor and wait for it to finish
const run = await client.actor("jobscrawler/linkedin-post-comments").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 = {
    "posts": [
        "https://www.linkedin.com/posts/microsoft-events_microsoft-build-has-arrived-in-seattle-and-ugcPost-7329991434395160578-GnK7?utm_source=share&utm_medium=member_desktop&rcm=ACoAACzazy4B3ajZsA0WxWr6m4S77iItYbYCLZM",
        "https://www.linkedin.com/feed/update/urn:li:activity:7320867199693246465/",
        "https://www.linkedin.com/feed/update/urn:li:ugcPost:7396563121059872768?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7396563121059872768%2C7396565439390076928%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287396565439390076928%2Curn%3Ali%3AugcPost%3A7396563121059872768%29",
    ],
    "maxItems": 10,
    "postedLimit": "any",
    "profileScraperMode": "short",
}

# Run the Actor and wait for it to finish
run = client.actor("jobscrawler/linkedin-post-comments").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 '{
  "posts": [
    "https://www.linkedin.com/posts/microsoft-events_microsoft-build-has-arrived-in-seattle-and-ugcPost-7329991434395160578-GnK7?utm_source=share&utm_medium=member_desktop&rcm=ACoAACzazy4B3ajZsA0WxWr6m4S77iItYbYCLZM",
    "https://www.linkedin.com/feed/update/urn:li:activity:7320867199693246465/",
    "https://www.linkedin.com/feed/update/urn:li:ugcPost:7396563121059872768?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7396563121059872768%2C7396565439390076928%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287396565439390076928%2Curn%3Ali%3AugcPost%3A7396563121059872768%29"
  ],
  "maxItems": 10,
  "postedLimit": "any",
  "profileScraperMode": "short"
}' |
apify call jobscrawler/linkedin-post-comments --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/5eEvXFcRBKcwc9kTs/builds/NlaeJNzYCWW1eO5Ui/openapi.json
