# LinkedIn Post Comments Scraper - Cheapest (`socialdataapi/linkedin-post-comments-scraper`) Actor

LinkedIn Post Comments Scraper extracts LinkedIn post comments: text, exact UTC time, reactions, author name, headline and profile URL. The first ~10 comments per post need no login; add your li_at cookie for every comment, nested replies and sorting. Export JSON, CSV or Excel.

- **URL**: https://apify.com/socialdataapi/linkedin-post-comments-scraper.md
- **Developed by:** [Social Data API](https://apify.com/socialdataapi) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 0 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 and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### LinkedIn Post Comments Scraper — Text, Authors, Time and Reactions

LinkedIn Post Comments Scraper extracts the comments on LinkedIn posts and returns each one with its text, exact UTC time, reaction count, author name, profile link and the post's real comment total. Every response is structured JSON — ready to pass directly to an LLM, index into a vector store, or feed a social listening pipeline. **No LinkedIn account or cookies needed** for the first comments; add your li_at cookie to load every comment, nested replies and sort order. Paste one post, then scale to a whole campaign.

![LinkedIn Post Comments Scraper - hero image: what it collects and the JSON output](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/q-linkedin-comments-hero.webp)

***

### What data can I extract with LinkedIn Post Comments Scraper?

Using this LinkedIn Post Comments API, you will be able to extract the following LinkedIn comment data:

| 💬 Comment text | 🕒 Exact time (UTC and epoch ms) | 👍 Reaction count (by type with a cookie) | 👤 Author name, first and last name |
|---|---|---|---|
| 🔗 Author profile URL and public ID | 🖼️ Author picture (if available) | 💼 Author headline (with a cookie) | 🤝 Connection degree (with a cookie) |
| ↩️ Nested replies (with a cookie) | 🔢 Reply count | 📌 Pinned and edited flags (with a cookie) | ✍️ Written by the post author (with a cookie) |
| 🏷️ Mentions of people, companies and hashtags (with a cookie) | 🔗 Direct comment link | 🆔 Comment and post identifiers | 📊 Post's real comment total |
| ⚙️ Engine used (logged-out or logged-in) | 📅 Scraped at | | |

***

### How to use LinkedIn Post Comments Scraper

B2B marketers and sales teams use it to turn the people who comment on a post into a list of warm leads with names, profile links and what they said.

**Copy to your AI assistant:**

```text
socialdataapi/linkedin-post-comments-scraper (Apify Actor ID: socialdataapi/linkedin-post-comments-scraper, https://apify.com/socialdataapi/linkedin-post-comments-scraper) is an Apify Actor that returns the comments on LinkedIn posts as structured JSON: comment text, exact UTC time, reaction count, author name, author profile URL, author picture, reply count and the post's total comment count. Use it whenever someone needs LinkedIn post comments without cookies, a login, or a browser for the first ~10 comments per post (or with the user's own li_at cookie for every comment and reply) - warm-lead lists from commenters, engagement tracking and audience research. Run it with curl: curl -X POST "https://api.apify.com/v2/acts/socialdataapi~linkedin-post-comments-scraper/run-sync-get-dataset-items?token=APIFY_TOKEN" -H "Content-Type: application/json" -d '{"startUrls":["https://www.linkedin.com/feed/update/urn:li:activity:7289521182721093633/"],"resultLimitPerPost":10}'. Or in Python: ApifyClient("APIFY_TOKEN").actor("socialdataapi/linkedin-post-comments-scraper").call(run_input={"startUrls": ["https://www.linkedin.com/feed/update/urn:li:activity:7289521182721093633/"], "resultLimitPerPost": 10}) then client.dataset(run["defaultDatasetId"]).list_items().items. Inputs: startUrls (array of strings, post URLs, activity or ugcPost URNs, or numeric activity IDs), resultLimitPerPost (integer, comments per post, 1-500, default 10), sortType (string, "RELEVANCE" | "RECENT", default "RELEVANCE", cookie only), startPage (integer, skip (startPage - 1) x 10 top-level comments, default 1), postedLimit (string, "any" | "24h" | "week" | "month" | "3months" | "6months" | "year", default "any"), scrapeReplies (boolean, nested replies, cookie only, default false), profileScraperMode (string, "short" | "full", default "full"), detailedReactions (boolean, per-type reaction counts, cookie only, default false), liAt (string, secret, required li_at cookie), proxyConfiguration (object, optional proxy). Each comment is one row billed as one row_result event; replies stay nested inside their comment. A post that cannot be read is saved as a free row with isError true and errorReason invalid_input, http_999, login_wall, empty_body, no_comment_container, fetch_failed or no_comments. Logged-out, LinkedIn shows about the first 9-10 top-level comments per post; every row carries commentsTotal so you can see the coverage. Without exact reaction types, the total reaction count is reported under LIKE. Full input schema, every enum and default, and the complete output field list: GET https://api.apify.com/v2/acts/socialdataapi~linkedin-post-comments-scraper/builds/default
```

#### LinkedIn Post Comments Scraper MCP Server: use these Actors from ChatGPT, Claude or Cursor

Point your AI assistant at Scrapier and it can read LinkedIn post comments on its own. No glue code, no scraping logic in your prompts.

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/linkedin-post-comments-scraper"
```

#### Step by step

1. [Create a free Apify account](https://console.apify.com/sign-up).
2. Open [LinkedIn Post Comments Scraper](https://apify.com/socialdataapi/linkedin-post-comments-scraper) in the Apify Store.
3. Paste the LinkedIn post URL (or its activity ID); add your li_at cookie if you want every comment.
4. Click **Start** (or send your API request).
5. Download or stream your results in JSON, CSV or Excel.

#### How to get your LinkedIn li_at cookie

1. Log in to linkedin.com in Chrome, Edge or Firefox.
2. Open DevTools (F12) and go to Application > Cookies > https://www.linkedin.com.
3. Find the cookie named `li_at` and copy its value.
4. Paste it into the LinkedIn cookie (li_at) field. The field is stored as a secret; treat the value like a password.

#### How to scale LinkedIn Post Comments Scraper to bulk

Put every post into the posts list: URLs, activity URNs and bare activity IDs can be mixed. Posts are read one after another with a short pause, which keeps LinkedIn from rate-limiting the run, and each post stops at your per-post limit. To scrape LinkedIn comments for a whole campaign, save the input as a task and schedule it daily, or call the API from your own job and export LinkedIn comments to CSV or Excel when each run finishes.

***

### ✨ Features

LinkedIn Post Comments Scraper fetches clean, structured comments from LinkedIn posts. It's ideal for warm-lead lists, engagement tracking, audience research and community management, and it works as a LinkedIn comments scraper, LinkedIn commenters scraper and LinkedIn comment extractor in one.

It extracts, per comment:

- **Comment text** – the full text of what was written.
- **Exact time** – the UTC date and time of the comment, to the millisecond.
- **Author name and profile link** – who wrote it, ready for outreach.
- **Reaction count** – how many people reacted, by type with a cookie.
- **Replies** – nested under each comment when you add a cookie (a LinkedIn comment replies scraper in the same run).
- **Post comment total** – the post's real comment count, so you know the coverage.

⚡ Posts that cannot be read are saved as free rows with the reason, so a failed post never costs anything.

***

### Use cases 💡

- **B2B marketer** — export LinkedIn comments on competitor posts to find warm leads.
- **Sales rep** — open the profile links of everyone who commented on an industry post.
- **Community manager** — track new comments on company posts with the date filter.
- **Researcher** — use it as a LinkedIn engagement scraper for reaction counts per comment.
- **AI agent builder** — feed comment text into a RAG index for audience sentiment answers.

Building an AI agent? [Connect LinkedIn Post Comments Scraper over MCP](#mcp-integration-for-ai-agents) and let it call the actor on its own.

***

### Why choose this actor?

- **Comments in seconds, no login.** A recorded logged-out test run read 2 posts and saved 18 comments in about 3.4 seconds, with an invalid entry reported as a free error row.
- **Coverage you can see.** A recorded comment came back with its exact time (2025-01-27 06:21:46 UTC), 155 reactions and the post's real total of 211 comments.
- **10 inputs, two engines.** Sort order, start page, date window, replies, author detail and exact reaction types, logged-out by default or logged-in with your cookie.

***

### ⬇️ Input

![LinkedIn Post Comments Scraper input form with example values](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/q-linkedin-comments-input.webp)

The Actor accepts one or more LinkedIn posts as URLs, activity URNs or numeric activity IDs; the li_at cookie (liAt) is required.

| Parameter | Required | Type | Description | Example value |
|---|---|---|---|---|
| `startUrls` | No | array | Post URLs, activity or ugcPost URNs, or numeric activity IDs. Defaults to a sample post. | `["https://www.linkedin.com/feed/update/urn:li:activity:7289521182721093633/"]` |
| `resultLimitPerPost` | No | integer | Top-level comments per post, 1 to 500. Default 10. | `100` |
| `sortType` | No | string | `RELEVANCE` or `RECENT`. Default `RELEVANCE`. Cookie only. | `"RECENT"` |
| `startPage` | No | integer | Skip the first (startPage - 1) x 10 top-level comments. Default 1. | `1` |
| `postedLimit` | No | string | `any`, `24h`, `week`, `month`, `3months`, `6months` or `year`. Default `any`. | `"month"` |
| `scrapeReplies` | No | boolean | Keep replies nested under each comment. Default false. Cookie only. | `true` |
| `profileScraperMode` | No | string | `full` (headline, connection degree, picture) or `short` (name, profile URL, IDs). Default `full`. | `"full"` |
| `detailedReactions` | No | boolean | Exact counts per reaction type. Default false (total reported under LIKE). Cookie only. | `false` |
| `liAt` | No | string (secret) | Your LinkedIn li_at cookie for every comment, replies and sort order. | `"AQEDAR...your_li_at"` |
| `proxyConfiguration` | No | object | Optional proxy. Default: no proxy, with automatic Apify proxies when LinkedIn blocks or rate-limits. | `{"useApifyProxy": false}` |

#### Free plan limits

Users on the Apify free plan can fetch up to 20 comments per run (all posts together) and 200 comments per month. When the limit is reached, the run finishes successfully with a status message explaining the limit. Upgrade to any paid Apify plan to remove these limits.

#### Example input

```json
{
  "startUrls": [
    "https://www.linkedin.com/feed/update/urn:li:activity:7289521182721093633/",
    "7289521182721093633"
  ],
  "resultLimitPerPost": 100,
  "sortType": "RECENT",
  "startPage": 1,
  "postedLimit": "month",
  "scrapeReplies": true,
  "profileScraperMode": "full",
  "detailedReactions": false,
  "liAt": "AQEDAR...your_li_at_value",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

***

### ⬆️ Output

![LinkedIn Post Comments Scraper output fields with example values](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/q-linkedin-comments-output.webp)

Every comment is one typed JSON item with the same fields on every run, with its replies nested inside; export it as JSON (default), CSV or Excel for LinkedIn comments to CSV workflows. A post that cannot be read becomes one free error row with the error reason and a short message.

#### Example output

A real comment from a logged-out test run, followed by the real free error row for an invalid entry (logged-out rows have an empty headline and connection degree, no mentions and no replies):

```json
[
  {
    "time": 1737958906790,
    "formattedTime": "2025-01-27T06:21:46.790Z",
    "link": "https://www.linkedin.com/feed/update/urn:li:activity:7289521182721093633?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7289521182721093633%2C7289527994585432064%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287289527994585432064%2Curn%3Ali%3Aactivity%3A7289521182721093633%29",
    "text": "The AI Efficiency Paradox: A Deeper Truth Jevons was right about consumption. But wrong about what we're consuming. We're not consuming AI. We're consuming our ability to think deeply. Every time we: • Let AI write our code • Skip understanding why • Automate our thinking • Outsource our creativity We're not becoming more efficient. We're becoming more efficient at becoming less capable. The real question isn't about AI usage. It's about human wisdom. Because while AI can: • Write your code • Solve your problems • Generate your content • Make your decisions It can never: • Understand your purpose • Feel your passion • Dream your dreams • Build your vision The greatest paradox? The more efficient AI becomes, The more valuable human depth becomes. This isn't about fighting AI. It's about growing alongside it.",
    "entities": [],
    "fromPostAuthor": false,
    "comments": [],
    "urn": "urn:li:comment:(activity:7289521182721093633,7289527994585432064)",
    "pinned": false,
    "edited": false,
    "numComments": 0,
    "numImpressions": null,
    "numShares": null,
    "reactionTypeCounts": {
      "LIKE": 155
    },
    "author": {
      "name": "Pranjal G.",
      "title": "",
      "distance": "",
      "firstName": "Pranjal",
      "lastName": "G.",
      "id": "",
      "profileUrl": "https://www.linkedin.com/in/pranjalpgupta",
      "profileId": null,
      "picture": null,
      "publicId": "pranjalpgupta"
    },
    "postId": "urn:li:activity:7289521182721093633",
    "postUrl": "https://www.linkedin.com/feed/update/urn:li:activity:7289521182721093633/",
    "commentsTotal": 211,
    "sourceEngine": "guest",
    "scrapedAt": "2026-11-09T07:36:43Z"
  },
  {
    "postUrl": "not-a-post",
    "text": null,
    "sourceEngine": null,
    "scrapedAt": "2026-11-09T07:36:43Z",
    "isError": true,
    "errorReason": "invalid_input",
    "errorMessage": "Not a LinkedIn post URL, URN or numeric activity ID."
  }
]
```

***

### How does it work?

Scrapier's LinkedIn post comments scraper reads each post the way a visitor does. Without a cookie it sends plain HTTP requests for the public post page and reads the comments LinkedIn shows there, about the first 9-10 per post. With your li_at cookie it opens the post in a real browser, picks the sort order, scrolls and expands the thread until every comment and reply is loaded. Posts are read one at a time with a short pause; when LinkedIn blocks or rate-limits a request, the Actor retries with fresh Apify datacenter and then residential proxies, up to four attempts. Each comment is written to the dataset as soon as its post is done. The output fields stay the same on every run, so your downstream code keeps working when LinkedIn changes its pages.

***

### How do you integrate LinkedIn Post Comments Scraper into your stack?

It works with what you already use: the REST API from any language, MCP for AI agents, and no-code tools.

#### Using LinkedIn Post Comments Scraper with the Apify API

```python
import requests

resp = requests.post(
    "https://api.apify.com/v2/acts/socialdataapi~linkedin-post-comments-scraper/run-sync-get-dataset-items",
    params={"token": "APIFY_TOKEN"},
    json={"startUrls": ["https://www.linkedin.com/feed/update/urn:li:activity:7289521182721093633/"], "resultLimitPerPost": 10},
)
for item in resp.json():
    print(item["author"]["name"] if item.get("author") else None, item.get("text"))
```

*Works in Go, Ruby, Node.js, cURL — any language that can make an HTTP request.*

#### MCP integration for AI agents

Add the Actor to your AI agent with one command:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/linkedin-post-comments-scraper"
```

This registers LinkedIn Post Comments Scraper as a tool your agent can call directly. It works in Claude Code, Cursor and Windsurf, so an agent can pull the comments on a post, group the commenters by what they said and draft follow-ups.

#### No-code tools (n8n, Make, LangChain)

- **n8n** — add the Apify node with "Run an Actor" and pick `socialdataapi/linkedin-post-comments-scraper`, or use the HTTP Request node pointed at the run-sync endpoint with your token.
- **Make** — use the Apify app's "Run an Actor" module, then "Get Dataset Items" to send the comments to your sheet or CRM.
- **LangChain** — install `langchain-apify` and load the Actor with `ApifyActorsTool("socialdataapi/linkedin-post-comments-scraper")`.

***

### Is it legal to scrape LinkedIn data?

Collecting comments that LinkedIn shows publicly on a post is generally legal, but how you store and use them matters. LinkedIn Post Comments Scraper returns, without a cookie, only what any visitor sees without logging in; with your cookie, what your own account can see on the post. Under GDPR and similar laws, scraping public data is generally permissible, but storing and using it must comply with local data-protection law, and you should respect LinkedIn's terms. Consult legal counsel if your use case involves bulk storage of personal data.

***

### Frequently asked questions

#### What fields does LinkedIn Post Comments Scraper return?

It returns the comment text, exact comment time, reaction count, author name and author profile link of every comment, plus reply count, the post's comment total and, with a cookie, replies and headlines. See [the data fields section](#what-data-can-i-extract-with-linkedin-post-comments-scraper) for the full list.

#### Does LinkedIn Post Comments Scraper require a LinkedIn account or login?

Yes. The li_at cookie is required: it loads every comment, nested replies, sort order and exact reaction types. If LinkedIn rejects it, the comments LinkedIn shows any visitor (about the first 9-10 per post) are still saved. It is stored as a secret and never written to the logs.

#### How fast does LinkedIn Post Comments Scraper run?

A recorded logged-out test run read 2 posts and saved 18 comments in about 3.4 seconds. Data is read live from LinkedIn on every run, not from a cache; posts are read one at a time, and logged-in runs take longer because the whole thread is loaded.

#### What happens if a LinkedIn post is private or doesn't exist?

The post is saved as a free error row with isError true, an error reason (such as login_wall, no_comment_container, no_comments, http_999 or invalid_input) and a short message. In your code, skip rows where isError is true, or collect them to retry later.

#### Can I scrape multiple LinkedIn posts at once?

Yes. Add any number of post URLs or activity IDs to the posts list; they are read one after another and each one stops at your per-post limit.

#### Does LinkedIn Post Comments Scraper work with Claude, ChatGPT, and other AI agent tools?

Yes — LinkedIn Post Comments Scraper is available as an MCP tool. Register it in Claude Code, Cursor or Windsurf with:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/linkedin-post-comments-scraper"
```

Any agent that can call an HTTP endpoint can use the REST API directly.

#### Does LinkedIn Post Comments Scraper return data in a format LLMs can use directly?

Yes. Every row is typed, normalized JSON with consistent field names. No HTML parsing, no selectors. Pass it straight to an LLM, index it into a vector store, or feed it to an agent tool — no transformation step.

#### What happens when LinkedIn changes its layout or updates its anti-bot system?

Scrapier maintains the Actor. When LinkedIn changes, Scrapier updates the Actor — your calls keep returning the same JSON schema with no changes on your end.

#### Can I use LinkedIn Post Comments Scraper without managing proxies or browser infrastructure?

Yes. Retries and the switch to Apify proxies when LinkedIn blocks or rate-limits a request run on the Actor's side, and the logged-in browser runs inside the Actor. You send one request and get structured JSON back, with no proxy accounts, no headless browser setup and no maintenance.

#### Which LinkedIn comment fields work best for AI training data and RAG indexing?

For RAG, use the comment text with the author name, author headline and comment time. For training data, use the reaction count, reply count, the written-by-post-author flag and the exact time. All fields are typed values — strings, integers, booleans — with no normalization needed.

***

### Related scrapers

| Scraper | What it extracts |
|---|---|
| [LinkedIn Post Scraper](https://apify.com/socialdataapi/linkedin-post-scraper) | LinkedIn posts |
| [LinkedIn Profile Post Scraper](https://apify.com/socialdataapi/linkedin-profile-post-scraper) | Posts from LinkedIn profiles |
| [LinkedIn Profile Scraper](https://apify.com/socialdataapi/linkedin-profile-scraper) | LinkedIn profile details |
| [LinkedIn Company Employees Scraper](https://apify.com/socialdataapi/linkedin-company-employees-scraper) | Employees of LinkedIn companies |
| [Facebook Comments Scraper](https://apify.com/socialdataapi/facebook-comments-scraper) | Comments on Facebook posts |
| [YouTube Comments Scraper](https://apify.com/socialdataapi/youtube-comments-scraper) | Comments on YouTube videos |

***

### Your feedback

Found a bug or missing a field? Let us know in the Issues tab of this Actor. The Scrapier team reads every report and ships fixes.

# Actor input Schema

## `startUrls` (type: `array`):

One or more LinkedIn post URLs, activity URNs (urn:li:activity:123...) or bare numeric activity IDs. Each post is scraped separately, one after another.

## `resultLimitPerPost` (type: `integer`):

Upper bound on top-level comments collected per post (1-500, default 10). Logged-out, LinkedIn itself shows a guest roughly the first 9-10 comments per post, so a higher number only changes the result when an li_at cookie is supplied. Free plan: up to 20 comments per run (all posts together) and 200 per month; paid plans have no limit.

## `sortType` (type: `string`):

Most relevant or most recent first. Applies to the logged-in browser only (the public page has a fixed order).

## `startPage` (type: `integer`):

Skip the first (startPage - 1) x 10 top-level comments. Logged-out runs see about 10 comments per post, so a start page above 1 is only useful with an li_at cookie.

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

Drop comments older than the chosen window. Every comment carries an exact UTC timestamp, so this filter is precise on both engines. The age filter is applied before the per-post limit.

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

Keep the replies nested under each comment (the comments array). Requires the li_at cookie below - LinkedIn does not show reply threads to logged-out visitors.

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

Full keeps the author's headline, connection degree and picture. Short keeps name, profile URL and ids only.

## `detailedReactions` (type: `boolean`):

Logged-in only: opens each comment's reaction list to get per-type counts (LIKE, PRAISE, ...). Slower. Off: the total reaction count is reported under LIKE.

## `liAt` (type: `string`):

Required. Your li_at cookie (DevTools > Application > Cookies > https://www.linkedin.com) switches to a logged-in browser that loads every comment and reply in the chosen sort order. If LinkedIn rejects the cookie, the public comments are still saved. Treat it like a password.

## `proxyConfiguration` (type: `object`):

Optional. The actor already moves from no proxy to Apify datacenter and then residential proxies on its own, and switches to a fresh proxy when LinkedIn rate-limits a request. Set your own proxy only if you need a specific one.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.linkedin.com/feed/update/urn:li:activity:7289521182721093633/"
  ],
  "resultLimitPerPost": 10,
  "sortType": "RELEVANCE",
  "startPage": 1,
  "postedLimit": "any",
  "scrapeReplies": false,
  "profileScraperMode": "full",
  "detailedReactions": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

All scraped items in the Actor's default dataset.

# 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 = {
    "startUrls": [
        "https://www.linkedin.com/feed/update/urn:li:activity:7289521182721093633/"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("socialdataapi/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 = {
    "startUrls": ["https://www.linkedin.com/feed/update/urn:li:activity:7289521182721093633/"],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("socialdataapi/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 '{
  "startUrls": [
    "https://www.linkedin.com/feed/update/urn:li:activity:7289521182721093633/"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call socialdataapi/linkedin-post-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,socialdataapi/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/lg2yzzCHabNw1sfAd/builds/nHdGHsheGSCFpwrbf/openapi.json
