Skip to content

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

LinkedIn Profile Posts

Collect posts from public LinkedIn member profiles by profile URL or public identifier. The examples call the hosted Apify Actor and return its default dataset as JSON.

Quick start

Set APIFY_TOKEN in your shell using your Apify integrations settings. Run one example from the repository root. Each live invocation starts a separate run and may incur charges.

Client Install Run
Python 3.11+ python3 -m pip install 'apify-client>=3,<4' python3 examples/python/run.py
Node.js 20+ npm install --no-save --package-lock=false apify-client@2 node examples/node/run.mjs
curl 7.55+ and Bash Use the system curl and Bash bash examples/curl/run.sh

Use --dry-run to print the input without installing the SDK, setting a token, or starting a run. To use your own input, pass its JSON file path as an argument. The SDK examples wait for the run to finish. For runs that could take more than five minutes, use an SDK or the asynchronous runs API instead of the synchronous HTTP request.

Example input

Get up to five posts from one profile, excluding reposts. See the Actor input form for more options.

{
  "profileUrls": [
    "https://www.linkedin.com/in/neilkpatel"
  ],
  "maxPosts": 5,
  "postedLimit": "any",
  "includeReposts": false
}

Output fields

Selected dataset fields. Availability varies by record and input settings.

Field Meaning
profileUrl Member profile supplied for the lookup
authorName Post author when available
postUrl Post link when available
text Full post text when available
postedDate Post publication time when available
isRepost Whether the member reposted it
source Whether the row came from LinkedIn or a saved archive copy

Pricing

Pricing checked on 2026-11-30 UTC. Prices are in USD per 1,000 events. Your Apify plan determines the tier. Check current pricing before running at scale.

Event FREE BRONZE SILVER GOLD PLATINUM DIAMOND When charged
Post $1.19 $0.99 $0.89 $0.79 $0.79 $0.79 One LinkedIn post delivered to the dataset, charged once per run.

SDK examples

The Python and Node.js scripts load the example JSON and read the token from APIFY_TOKEN. These are the functions they use to start a run and read its dataset.

Python

def run_actor(payload, token):
    from apify_client import ApifyClient

    client = ApifyClient(token=token)
    run = client.actor("deepmine/linkedin-profile-posts").call(run_input=payload)
    if run is None or run.status != "SUCCEEDED" or not run.default_dataset_id:
        raise RuntimeError("Actor run did not succeed; check Apify Console.")
    return list(client.dataset(run.default_dataset_id).iterate_items())

Node.js

export async function runActor(payload, token) {
  const { ApifyClient } = await import('apify-client');
  const client = new ApifyClient({ token });
  const run = await client.actor("deepmine/linkedin-profile-posts").call(payload);
  if (run?.status !== 'SUCCEEDED' || !run.defaultDatasetId) {
    throw new Error('Actor run did not succeed; check Apify Console.');
  }
  const dataset = client.dataset(run.defaultDatasetId);
  const records = [];
  for (let offset = 0; ; ) {
    const { items, total } = await dataset.listItems({ offset, limit: 1000 });
    records.push(...items);
    offset += items.length;
    if (items.length === 0 || offset >= total) return records;
  }
}

MCP

Merge mcp/config.json into your MCP client configuration and replace YOUR_APIFY_TOKEN in your local copy. The Apify MCP server runs via npx with Node.js 22 or later.

{
  "mcpServers": {
    "linkedin-profile-posts": {
      "command": "npx",
      "args": [
        "-y",
        "@apify/actors-mcp-server@0.23.0",
        "--tools",
        "deepmine/linkedin-profile-posts",
        "--no-telemetry-enabled"
      ],
      "env": {
        "APIFY_TOKEN": "YOUR_APIFY_TOKEN"
      }
    }
  }
}

Example prompt: Get up to five posts from Neil Patel’s LinkedIn profile without reposts. Return post links and dates.

n8n

Import n8n/workflow.json. In Run Actor, select a Header Auth credential with header name Authorization and value Bearer YOUR_APIFY_TOKEN, using your own token. Start the manual trigger to run the HTTP Request node and read the dataset.

FAQ

Why can older posts show different counts?
When source is archive, the counts are from the saved copy and may differ from current counts.

Can I preview the input without a run?
Yes. Append --dry-run to any command in the quick start.

The example code is available under the MIT License.

Releases

Packages

Contributors