mcpField
L
linkedin-posts

linkedin-posts

远程服务
apify.com社交媒体01 天前更新

关于 linkedin-posts

linkedin-posts 是基于 Apify 的 API,可将公开 LinkedIn 帖子整理为结构化 JSON,适用于研究人员和 AI Agent。它可从个人资料 URL 发现近期帖子,也可按指定帖子 URL 获取内容及互动和作者信息。

主要功能

  1. 01按个人资料 URL 发现近期帖子
  2. 02按指定 URL 获取帖子
  3. 03返回文本、话题标签、媒体和链接
  4. 04包含反应、评论和分享数
  5. 05提供作者信息和帖子摘要

适用场景

  1. 01研究公开个人资料的近期内容
  2. 02分析帖子互动情况
  3. 03监测公开 LinkedIn 讨论
  4. 04整理结构化社交数据以供分析

MCP 相关

通过 Apify 托管的 MCP 服务将 LinkedIn Posts API 作为工具提供,供 MCP 客户端收集公开帖子。

配置

远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。

服务地址https://mcp.apify.com/?tools=johnvc/linkedin-posts-api
一键复制安装命令
Claude CodeTerminal
Cursor.cursor/mcp.json
VS Code.vscode/mcp.json
Claude Desktopclaude_desktop_config.json
Windsurf~/.codeium/windsurf/mcp_config.json

命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。

工具

详细介绍

📝 LinkedIn Posts API:将帖子和互动数据转换为结构化 JSON

使用 LinkedIn Posts API 的最高效、可靠且对开发者友好的方式。

Actor 页面: apify.com/johnvc/linkedin-posts-api 输入架构: apify.com/johnvc/linkedin-posts-api/input-schema

提供一个公开的 LinkedIn 个人资料 URL,即可发现该用户近期发布的帖子;也可以传入特定帖子 URL,直接获取帖子数据。每篇帖子都会返回一条简洁的 JSON 记录,包含文本、反应、评论、分享、话题标签、媒体和作者详情。本工具以 API 为先,并已支持 MCP,因此你可以通过 Python 调用它,也可以将其作为工具交由 AI Agent 使用。

视频演示

观看演示

快速开始

前提条件
  1. 克隆代码库

    git clone https://github.com/johnisanerd/Apify-LinkedIn-Posts-API.git
    cd Apify-LinkedIn-Posts-API
    
  2. 使用 UV 安装依赖项

    # Install UV if you do not have it:
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # Install project dependencies:
    uv sync
    
  3. 配置 API 密钥

    cp .env.example .env
    # Edit .env and add your Apify API key
    # Get your free API key at: https://apify.com?fpr=9n7kx3
    
  4. 运行示例

    uv run python linkedin-posts-api-example.py
    
另一种方式:直接设置 API 密钥
export APIFY_API_TOKEN="your_api_key_here"
uv run python linkedin-posts-api-example.py

为什么使用这个 LinkedIn Posts API?

输入 URL,输出结构化数据。 你无需接触数据采集基础设施。传入个人资料 URL(或特定帖子 URL),即可获取扁平、可预测的字段,并直接载入电子表格、数据库或 BI 工具。

两种采集方式。 发现个人资料近期发布的帖子(按最新时间排序,可限制数量并按日期筛选),或通过 URL 获取一组已知帖子,每次运行最多可获取 1000 条。

按帖子付费。 按返回的帖子数量计费,不收取每次运行的设置费,因此你只需为实际交付的内容付费。

可靠且可预测。 每篇帖子都会以相同的字段结构返回;如果个人资料没有公开帖子,则会返回清晰的错误记录,而不会导致整个运行失败。

已支持 MCP。 可将其作为工具交由 Claude、Cursor 和其他 AI Agent 调用(请参阅下方的安装部分)。

功能

核心功能
  • 通过个人资料 URL 发现近期发布的帖子,或通过 URL 获取特定帖子
  • 帖子文本、话题标签、媒体和链接,以及帖子类型和日期
  • 每篇帖子的反应、评论和分享
  • 作者姓名、标题、关注者数量和热门评论示例
数据质量
  • 每篇帖子始终返回一条格式一致的 JSON 记录
  • 每条记录都包含易于理解的 summary 字段,方便快速浏览和供 AI 使用
  • 对于没有公开帖子的个人资料,返回清晰的错误记录,避免单个空资料影响整批结果

使用示例

发现个人资料的帖子
{
  "profileUrls": ["https://www.linkedin.com/in/williamhgates"],
  "maxPostsPerProfile": 5
}
将发现范围限制在指定日期区间
{
  "profileUrls": ["https://www.linkedin.com/in/williamhgates"],
  "maxPostsPerProfile": 50,
  "startDate": "2025-01-01",
  "endDate": "2025-12-31"
}
通过 URL 获取特定帖子
{
  "postUrls": [
    "https://www.linkedin.com/posts/williamhgates_activity-7446904645010210816"
  ]
}

输入参数

参数类型必填默认值描述
profileUrlslist[str]以下参数至少提供一个-用于发现帖子的公开 LinkedIn /in/ 个人资料 URL。每次运行最多 25 个。
postUrlslist[str]以下参数至少提供一个-用于直接获取帖子的特定 LinkedIn 帖子 URL。每次运行最多 1000 个。
maxPostsPerProfileint否20发现模式下每个个人资料的帖子数量上限(最多 200)。用于限制成本。对帖子 URL 无效。
startDatestr否-仅发现此日期或之后发布的帖子(YYYY-MM-DD)。仅适用于发现模式。
endDatestr否-仅发现此日期或之前发布的帖子(YYYY-MM-DD)。仅适用于发现模式。

至少提供 profileUrls 或 postUrls 其中之一。

输出格式

每篇帖子都会作为一条 JSON 记录返回:

{
  "result_type": "post",
  "postId": "7446904645010210816",
  "postUrl": "https://www.linkedin.com/posts/williamhgates_activity-7446904645010210816",
  "postType": "post",
  "datePosted": "2025-06-01T12:00:00.000Z",
  "text": "A few books shaped how I think about clean energy this year...",
  "hashtags": ["cleanenergy", "books"],
  "authorName": "williamhgates",
  "authorHeadline": "Co-chair, Bill & Melinda Gates Foundation",
  "authorUrl": "https://www.linkedin.com/in/williamhgates",
  "authorFollowers": 37000000,
  "numLikes": 12045,
  "numComments": 843,
  "numShares": 210,
  "summary": "Post by williamhgates, 12,045 reactions, 843 comments, posted 2025-06-01"
}

如果帖子有分享,则会返回 numShares 字段。


常见问题解答

这会让我的 LinkedIn 或 LinkedIn Recruiter 账号面临风险吗?

不会。它只读取公开的 LinkedIn 页面,也就是任何人退出登录后都能打开的页面。它绝不会登录,也不会索要你的 Cookie:没有用于输入账号、密码或 li_at 会话 Cookie 的字段。它所做的一切都与你的 LinkedIn 账号、LinkedIn Recruiter 席位或 Sales Navigator 许可证无关。请求会在 Apify 的服务器上运行,而不是在你的浏览器中运行,因此无法与你关联;运行期间,你也可以继续使用 Recruiter。


在 Claude Cowork Desktop 中安装

在 Claude Cowork Desktop 中安装

Cowork 是桌面应用的自动化模式。要让它使用 LinkedIn Posts API 作为工具,请将 Apify MCP 服务添加为连接器。

  1. 打开 Claude 桌面应用,前往 Settings → Connectors(或前往 Settings → Developer → Edit Config,直接编辑 claude_desktop_config.json)。
    • macOS:~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows:%APPDATA%\Claude\claude_desktop_config.json
  2. 添加 Apify MCP 服务,并且只预加载此 Actor:
{
  "mcpServers": {
    "apify": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://mcp.apify.com/?tools=actors,docs,johnvc/linkedin-posts-api"
      ]
    }
  }
}
  1. 重启应用。Cowork 首次调用工具时,请在浏览器中完成 OAuth 提示词流程,或者在连接器设置中添加 Apify API 令牌以跳过 OAuth。
  2. 在 Cowork 聊天中确认工具已可用,然后让它运行 LinkedIn Posts API。

下载桌面应用并开始免费试用:https://claude.ai/referral/uIlpa7nPLg 更多帮助:https://docs.apify.com/platform/integrations/claude-desktop


在 Claude Code 中安装

在 Claude Code 中安装

Claude Code 是命令行工具。使用一条命令添加 Actor 的 MCP 服务:

claude mcp add --transport http apify \
  "https://mcp.apify.com/?tools=actors,docs,johnvc/linkedin-posts-api"

要使用令牌而不是浏览器 OAuth:

claude mcp add --transport http apify \
  "https://mcp.apify.com/?tools=actors,docs,johnvc/linkedin-posts-api" \
  --header "Authorization: Bearer YOUR_APIFY_TOKEN"

然后使用 claude mcp list 验证,或在会话中运行 /mcp。让 Claude Code 调用 LinkedIn Posts API。

免费试用 Claude Code:https://claude.ai/referral/uIlpa7nPLg Claude Code MCP 文档:https://code.claude.com/docs/en/mcp


在 Claude(网站)中安装

在 Claude(网站)中安装

在 claude.ai 上,你需要将 Apify 添加为连接器,然后仅启用此 Actor 的工具。

  1. 前往 Settings → Connectors → Browse connectors,搜索 Apify MCP server。安装它(如出现提示,请启用或更新)。
  2. 连接时,使用 Apify API 令牌进行身份验证,并启用工具 johnvc/linkedin-posts-api。
  3. 在任意聊天中,打开 + → Connectors 并启用 Apify。
  4. 你也可以选择 Add custom connector,粘贴完整的 MCP URL https://mcp.apify.com/?tools=actors,docs,johnvc/linkedin-posts-api,并在出现提示时使用 OAuth。
  5. 让 Claude 运行 LinkedIn Posts API。

在网页上打开 Claude:https://claude.ai/referral/uIlpa7nPLg


在 Cursor 中安装

在 Cursor 中安装

Cursor 会从项目文件 .cursor/mcp.json 中读取 MCP 服务。

  1. 在项目中创建 .cursor/mcp.json:
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com/?tools=actors,docs,johnvc/linkedin-posts-api"
    }
  }
}
  1. 如果你更倾向于使用令牌身份验证,而不是浏览器 OAuth,请添加一个标头:
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com/?tools=actors,docs,johnvc/linkedin-posts-api",
      "headers": { "Authorization": "Bearer YOUR_APIFY_TOKEN" }
    }
  }
}
  1. 打开 Cursor → Settings → MCP,确认 apify 服务已连接(绿点)。
  2. 在 Composer 或 Chat 中,让 Cursor 调用 LinkedIn Posts API。

刚开始使用 Cursor?从这里获取:https://cursor.com/referral?code=XQP4VBLI3NNX


在 ChatGPT 中安装

在 ChatGPT 中安装

ChatGPT 通过开发者模式连接 Apify MCP 服务(ChatGPT Pro、Plus、Business、Enterprise 和 Education 计划均可使用)。

  1. 点击个人资料图标,然后前往 Settings > Apps。如果没有看到 Create app 按钮,请打开 Advanced settings 并启用 Developer mode。
  2. 点击 Create app 并填写表单:
    • Name: Apify
    • MCP Server URL: https://mcp.apify.com/?tools=actors,docs,johnvc/linkedin-posts-api
    • Authentication: OAuth
  3. 点击 Create,并通过 Apify 授权连接。
  4. 如需在对话中使用此应用,请点击聊天中的 +,选择 Developer mode,然后选择 Apify。

更多帮助:https://docs.apify.com/platform/integrations/mcp


用心打造

使用 LinkedIn Posts API 进行内容研究、社交聆听和互动分析,获取可靠的结构化结果。

🤖 向 AI 助手咨询此 Actor

在你选择的 AI 中打开一条关于 LinkedIn Posts API 的即发提示词:

最后更新:2026.10.27

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。