# Linkedin Post Comments Scraper (`api-ninja/linkedin-post-comments-scraper`) Actor

Collect raw comments and replies from one or more public LinkedIn post URLs.

- **URL**: https://apify.com/api-ninja/linkedin-post-comments-scraper.md
- **Developed by:** [API ninja](https://apify.com/api-ninja) (community)
- **Stats:** 6 total users, 6 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 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.
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

### What does LinkedIn Post Comments Scraper do?

**LinkedIn Post Comments Scraper extracts comments, replies, commenter profiles, engagement metrics, and media from public [LinkedIn](https://www.linkedin.com/) posts.** Add one or more post URLs, choose how many top-level comments you need, and receive a clean dataset ready for research, analysis, outreach preparation, or reporting.

You do not need to provide LinkedIn cookies or write scraping code. The Actor resolves every post URL, paginates its comments, optionally collects all replies, and transforms noisy source responses into useful fields while retaining the complete original object in `rawData`.

Running the scraper on Apify gives you:

- 🔗 Support for one or many LinkedIn post URLs in a single run
- 💬 Automatic pagination through top-level comments
- ↪️ Optional collection and pagination of every available reply
- 👤 Commenter names, headlines, profile links, photos, IDs, and account indicators
- 📊 Likes, reply counts, reaction breakdowns, timestamps, mentions, links, and hashtags
- 🖼️ Highest-resolution available profile and comment images
- 📦 Downloads in JSON, CSV, Excel, HTML, XML, and other formats
- 🔌 API access, scheduling, cloud storage, monitoring, webhooks, and integrations
- 🔁 Automatic retries for temporary failures and malformed upstream responses

### Why use LinkedIn Post Comments Scraper?

LinkedIn comments contain direct signals about what professionals care about, which questions they ask, and how an audience responds to a topic. This LinkedIn comments scraper removes the need to open threads manually and copy information one comment at a time.

Common use cases include:

- **Audience research** — understand who engages with your content or relevant industry posts.
- **Lead research** — discover professionals already discussing a product, problem, company, or market.
- **Voice-of-customer analysis** — collect questions, objections, opinions, and recurring language.
- **Content research** — find topics and conversations that generate meaningful discussion.
- **Brand monitoring** — follow feedback under announcements, launches, and company updates.
- **Community discovery** — identify active contributors and frequent conversation participants.
- **Sentiment and topic analysis** — export text into spreadsheets, BI tools, or language models.
- **Engagement reporting** — compare likes, replies, and reaction types across conversations.

Each result is normalized for immediate use, but technical users can still inspect the original LinkedIn response under `rawData`.

### How to scrape LinkedIn post comments

1. Open LinkedIn and copy the URL of a public post.
2. Open this Actor in Apify Console and click **Try for free**.
3. Add the URL under **LinkedIn post URLs**. Add more rows to process multiple posts.
4. Set **Maximum comments per post**, or enable **Scrape all comments**.
5. Choose **Relevance** or **Newest first** as the comment sort order.
6. Enable **Scrape replies** if you also need every reply to the collected top-level comments.
7. Click **Start** and wait for the run to finish.
8. Open the **Output** tab to browse the clean **LinkedIn comments** table.
9. Download the dataset or access it through the Apify API.

For a quick first test, use one public post, leave the limit at 100 comments, and keep reply scraping off. Once you have checked the output, enable replies or scrape all comments for complete conversation coverage.

#### How comment and reply limits work

`maxComments` applies separately to each input post and counts only top-level comments. Replies do not consume this limit.

When `parseAllComments` is enabled, the Actor ignores `maxComments` and requests pages until no more top-level comments are returned. When `scrapeReplies` is enabled, the Actor checks every saved top-level comment and automatically paginates all replies reported for that comment.

For example, if a post produces 100 saved top-level comments and those comments contain 35 replies, the final dataset contains 135 records: 100 with `recordType: "COMMENT"` and 35 with `recordType: "REPLY"`.

### Input

The Input tab contains five straightforward settings:

| Field              | Type    | Description                                                                               |
| ------------------ | ------- | ----------------------------------------------------------------------------------------- |
| `postUrls`         | Array   | One or more public LinkedIn post URLs.                                                    |
| `maxComments`      | Integer | Maximum top-level comments saved per post.                                                |
| `parseAllComments` | Boolean | Ignore `maxComments` and collect every available top-level comment.                       |
| `sortOrder`        | Select  | Use `RELEVANCE` or `REVERSE_CHRONOLOGICAL` (newest first).                                |
| `scrapeReplies`    | Boolean | Collect and automatically paginate all replies belonging to the saved top-level comments. |

Example input:

```json
{
    "postUrls": ["https://www.linkedin.com/posts/example_company-update-activity-1234567890"],
    "maxComments": 100,
    "parseAllComments": false,
    "sortOrder": "RELEVANCE",
    "scrapeReplies": true
}
```

Only public, accessible LinkedIn post URLs are supported. Private, deleted, restricted, or malformed URLs may not return data.

### Output

The Actor saves one normalized dataset item for every top-level comment and every fetched reply. The **LinkedIn comments** view shows the most useful fields with formatted images, links, dates, numbers, and booleans. Apify's **All fields** view also contains technical identifiers, extracted metadata, and the complete original API object in `rawData`.

Simplified top-level comment:

```json
{
    "recordType": "COMMENT",
    "commentText": "This is a useful breakdown. Thanks for sharing!",
    "commentId": "urn:li:comment:(activity:7451935765049044992,7451936392399532033)",
    "parentCommentId": null,
    "activityId": "urn:li:activity:7451935765049044992",
    "postUrl": "https://www.linkedin.com/posts/example",
    "commentUrl": "https://www.linkedin.com/feed/update/example?commentUrn=example",
    "createdAt": "2026-04-20T10:14:46.231Z",
    "isReply": false,
    "isEdited": false,
    "isPinned": false,
    "likes": 31,
    "replies": 6,
    "reactionBreakdown": {
        "LIKE": 30,
        "INTEREST": 1
    },
    "commenterName": "Fabio Ciucci",
    "commenterHeadline": "Serial Founder",
    "commenterProfileUrl": "https://www.linkedin.com/in/fciucci",
    "commenterImageUrl": "https://media.licdn.com/example-profile-image.jpg",
    "commenterConnectionDegree": "3rd+",
    "commenterIsPostAuthor": false,
    "commenterIsPremium": true,
    "commenterIsVerified": false,
    "commentImageUrl": null,
    "mentions": [],
    "hashtags": [],
    "contentLinks": [],
    "originalLanguage": null,
    "rawData": {}
}
```

A reply uses the same structure, with `recordType` set to `REPLY`, `isReply` set to `true`, and `parentCommentId` identifying the top-level comment it belongs to.

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel. Results are also available programmatically through the [Apify Dataset API](https://docs.apify.com/api/v2#/reference/datasets).

### LinkedIn comments data table

| Field                       | Description                                                           |
| --------------------------- | --------------------------------------------------------------------- |
| `recordType`                | Whether the record is a top-level `COMMENT` or a `REPLY`.             |
| `commentText`               | Text written by the commenter.                                        |
| `commentId`                 | Canonical LinkedIn comment or reply URN.                              |
| `parentCommentId`           | Parent comment URN for replies; empty for top-level comments.         |
| `activityId`                | Internal LinkedIn activity URN resolved from the input post.          |
| `postUrl`                   | Original LinkedIn post URL supplied in the input.                     |
| `commentUrl`                | Direct LinkedIn permalink for the comment or reply when available.    |
| `createdAt`                 | Comment creation time in ISO 8601 format.                             |
| `likes`                     | Total likes or reactions reported for the comment.                    |
| `replies`                   | Number of replies reported for that record.                           |
| `reactionBreakdown`         | Reaction totals grouped by LinkedIn reaction type.                    |
| `commenterName`             | Displayed name of the commenter.                                      |
| `commenterHeadline`         | Professional headline or subtitle.                                    |
| `commenterProfileUrl`       | Link to the commenter's LinkedIn profile.                             |
| `commenterImageUrl`         | Highest-resolution available profile image.                           |
| `commenterConnectionDegree` | Connection label such as `1st`, `2nd`, or `3rd+`.                     |
| `commenterIsPostAuthor`     | Whether the commenter is the author of the original post.             |
| `commenterIsPremium`        | Whether the response includes a LinkedIn Premium indicator.           |
| `commenterIsVerified`       | Whether the response includes a verified indicator.                   |
| `commentImageUrl`           | Highest-resolution image attached to the comment, when present.       |
| `mentions`                  | Profiles mentioned in the comment text.                               |
| `hashtags`                  | Hashtags extracted from the comment text.                             |
| `contentLinks`              | Web links extracted from the comment text.                            |
| `rawData`                   | Complete unmodified comment or reply object from the source response. |

Some values may be empty because LinkedIn does not expose every field for every person or comment. The original object in `rawData` can help with advanced processing or debugging.

### How much does it cost to scrape LinkedIn comments?

The exact cost depends on the pricing displayed in the Actor's **Pricing** tab and the amount of work performed during a run. The main cost factors are:

- Number of LinkedIn post URLs
- Number of top-level comments requested for each post
- Whether **Scrape all comments** is enabled
- Whether **Scrape replies** is enabled and how many replies the threads contain
- Number of pagination requests and temporary retries
- Dataset storage and data transfer

For a practical estimate, run one representative post with a limit of 100 comments, review its run cost, and scale from there. Large or viral posts with deeply nested discussions require more requests and take longer.

You may be able to cover small tests with usage included in your current Apify plan. Check the Actor's **Pricing** tab and [Apify pricing](https://apify.com/pricing) for current prices, credits, and plan limits before starting a large collection.

### Tips and advanced options

#### Start with a limited run

Use one post and 50–100 comments to confirm that the URL is public and the output contains the data you need. Increase the limit or enable **Scrape all comments** afterward.

#### Enable replies only when needed

Reply collection can significantly increase the number of API requests and dataset records. Leave **Scrape replies** off when you only need the main discussion participants; enable it when conversation context matters.

#### Choose the right sort order

Use `RELEVANCE` to retrieve the comments LinkedIn considers most relevant. Use `REVERSE_CHRONOLOGICAL` for newest-first monitoring. The selected order affects which comments fill a limited run.

#### Process media URLs promptly

LinkedIn profile and comment image URLs may be temporary and can expire. Download or process important media soon after the run rather than treating these URLs as permanent file storage.

#### Schedule recurring comment monitoring

Save a tested configuration as an Apify Task and run it with [Apify schedules](https://docs.apify.com/platform/schedules). Connect webhooks, Make, Zapier, Google Sheets, or your own application to process each completed dataset.

#### Access LinkedIn comments through an API

Developers can start runs and retrieve datasets through the Apify API, JavaScript client, Python client, or CLI. Use the same JSON structure shown in the input example. Keep your Apify API token private and never place it in client-side code or public repositories.

### Related LinkedIn Actors

Combine this Actor with other LinkedIn data tools for broader research:

- **LinkedIn Post Reactions Scraper** — collect the people and reaction types associated with a post.
- **LinkedIn Company Posts Scraper** — find and analyze content published by companies.
- **LinkedIn Profile Posts Scraper** — collect posts published by selected profiles.
- **LinkedIn Jobs Scraper** — extract structured LinkedIn job listings.

### FAQ, disclaimers, and support

#### Can I scrape comments from multiple LinkedIn posts?

Yes. Add multiple URLs to `postUrls`. The comment limit applies independently to every post.

#### Does the comment limit include replies?

No. `maxComments` limits top-level comments only. When reply scraping is enabled, replies are additional dataset records and are collected for the saved top-level comments.

#### Why did the Actor return fewer comments than requested?

The post may contain fewer public comments than the requested limit. LinkedIn may also hide, delete, restrict, or omit some comments. Confirm that the post is public and inspect the run log for URL-resolution or upstream API errors.

#### Why are replies missing?

Confirm that **Scrape replies** was enabled. The run's starting log should show `"replies":"all"`. Replies are requested only for saved top-level comments that report one or more replies.

#### Why are some commenter fields empty?

LinkedIn does not return complete profile information for every user. Restricted, deleted, private, organization, or ghost profiles may not include a photo, headline, connection degree, profile URL, or account indicators.

#### Can I use the results through an API?

Yes. Runs and datasets are available through the [Apify API](https://docs.apify.com/api/v2). You can also use Apify's JavaScript and Python clients, CLI, Tasks, schedules, webhooks, and integrations.

#### Is scraping LinkedIn comments legal?

Web scraping laws and platform terms vary by country and use case. Collect only publicly available information, respect LinkedIn's terms and applicable privacy or data-protection laws, and do not use the Actor for spam, discrimination, harassment, or other harmful purposes. You are responsible for how you configure and use the Actor. This Actor is not affiliated with or endorsed by LinkedIn.

#### What are the known limitations?

- Private, deleted, restricted, or unsupported posts may not return results.
- LinkedIn or upstream provider changes can temporarily affect data availability.
- Some comments and profile fields may be missing from the public response.
- Media URLs may expire.
- Very large discussions require more pagination requests and take longer.
- Comment counts displayed on LinkedIn can differ from records available through the underlying response.

#### Where can I get help or request a custom solution?

If a run fails, open its log and verify that the post URL is public and accessible. Report reproducible problems through the Actor's [Issues tab](./issues) and include the run ID, input URL, and expected behavior. Never post API tokens, credentials, or private data.

Custom LinkedIn scraping, data normalization, enrichment, and workflow integrations are also available on request.

# Actor input Schema

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

Add one or more public LinkedIn post URLs. Each URL is resolved to its internal activity ID before comments are collected.

## `maxComments` (type: `integer`):

Maximum number of top-level comments to save for each post. Ignored when Scrape all comments is enabled.

## `parseAllComments` (type: `boolean`):

Keep requesting comment pages for each post until the API returns an empty comments list.

## `sortOrder` (type: `string`):

Choose whether LinkedIn comments are requested by relevance or newest first.

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

Fetch and automatically paginate all replies for every saved top-level comment. Turn off to collect only top-level comments.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.linkedin.com/posts/rajeshrana84_aws-serverless-cloudcomputing-share-7504302581205073920-63AH/?utm_source=social_share_send&utm_medium=member_desktop_web&rcm=ACoAAB1kQ2MBs0WTeYdJt4DMlyQvQKI034yxsnA"
  ],
  "maxComments": 100,
  "parseAllComments": false,
  "sortOrder": "RELEVANCE",
  "scrapeReplies": false
}
```

# Actor output Schema

## `results` (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/rajeshrana84_aws-serverless-cloudcomputing-share-7504302581205073920-63AH/?utm_source=social_share_send&utm_medium=member_desktop_web&rcm=ACoAAB1kQ2MBs0WTeYdJt4DMlyQvQKI034yxsnA"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-ninja/linkedin-post-comments-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/rajeshrana84_aws-serverless-cloudcomputing-share-7504302581205073920-63AH/?utm_source=social_share_send&utm_medium=member_desktop_web&rcm=ACoAAB1kQ2MBs0WTeYdJt4DMlyQvQKI034yxsnA"] }

# Run the Actor and wait for it to finish
run = client.actor("api-ninja/linkedin-post-comments-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/rajeshrana84_aws-serverless-cloudcomputing-share-7504302581205073920-63AH/?utm_source=social_share_send&utm_medium=member_desktop_web&rcm=ACoAAB1kQ2MBs0WTeYdJt4DMlyQvQKI034yxsnA"
  ]
}' |
apify call api-ninja/linkedin-post-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,api-ninja/linkedin-post-comments-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/9gGPYWRKT9tlgc0LD/builds/bk7CxoosEgdaV6Scx/openapi.json
