你手上有一份 LinkedIn 个人资料网址列表,每一行都要回答同一个问题:这个人现在在哪里工作,职位是什么?LinkedIn 当前公司 API 可以从公开个人资料中直接给出答案。使用 ProfileHunt 时,发送网址即可;experience 数组中 end_date: null 的职位就是此人当前的工作,每条都带有 company、company_url 和 title。其中的 company_url 可用于把此人与完整的公司记录关联起来。
本文介绍当前职位在公开个人资料中的位置、哪些字段承载这些信息、会让朴素代码出错的边界情况、与公司数据的关联方式,以及职位变动检测,并附 cURL、Python 和 Node 示例。响应中每个字段的完整说明,请参阅 LinkedIn 个人资料 JSON 结构。
要点速览
- 当前职位 =
end_date: null。 按此条件筛选experience。每人可能有零个、一个或多个当前职位。 title只针对当前职位设置。 过去的职位为null;LinkedIn 对未登录访问者隐藏职位时,也为null。company_url是关联键。 将其发送到 ProfileHunt 公司接口,即可获取雇主的行业、规模、总部和官网。- 职位变动是一个差异。 比较两次读取之间当前
company_url的集合,并用新职位的start_date确定变动时间。
当前职位在公开 LinkedIn 个人资料中的位置
当前职位位于公开个人资料的"工作经历"部分,也就是未登录用户看到的版本。那里的每段经历都有雇主、可选的雇主主页链接、起止日期,以及(对于当前职位)职位名称。
成员自己决定公开给未登录用户看到多少内容。根据 LinkedIn 关于公开个人资料可见性的帮助页面,成员可以选择向未登录用户展示哪些板块,并且并非所有板块都能公开展示。因此,有些资料只显示当前雇主而不显示职位,还有些资料根本没有公开的工作经历。
公开页面还以机器可读的形式提供职位信息。LinkedIn 在页面中嵌入了 schema.org 数据,其中 Person 使用 worksFor 列出当前雇主,使用 jobTitle 列出职位。ProfileHunt 只读取公开视图,不使用任何 LinkedIn 账户、Cookie 或会话。
ProfileHunt 如何返回当前职位与雇主
ProfileHunt 把当前职位放在个人资料对象的 experience 数组中。所有键都始终存在,因此你只需检查值,无需检查键是否存在。
字段(位于 experience[] 中) | 类型 | 对当前职位的含义 |
|---|---|---|
company | string | 个人资料上显示的雇主名称。始终有值。 |
company_url | string 或 null | 雇主的 LinkedIn 主页。该职位未关联主页时为 null。 |
title | string 或 null | 仅对当前职位设置。对未登录访问者隐藏时为 null。 |
start_date | string 或 null | "2014" 或 "2014-02",与 LinkedIn 显示的格式一致。 |
end_date | string 或 null | 当前职位为 null。 |
location、description | string 或 null | 在公开视图中通常为 null。 |
个人资料接口参考是这些字段的权威来源。在 ProfileHunt 的输出中,当前职位排在前面,过去的职位随后。
扁平列:current_company、current_title、current_company_url
电子表格不适合处理嵌套数组,因此在需要扁平文件的场景中,ProfileHunt 也提供当前职位的扁平列:
| 输出位置 | 扁平列 |
|---|---|
| ProfileHunt Apify actor 数据集(JSON、CSV、Excel) | current_company、current_title、current_company_url |
| ProfileHunt 仪表板 Playground 中的批量 CSV 下载 | current_company、current_title |
REST API(POST /v1/profile) | 无:直接读取 experience[] |
扁平列取的是 experience 中的第一项,即此人列在最前面的当前职位,这是单列 CRM 字段的合理默认值。如果需要所有当前职位,请完整读取 experience。
步骤 1:获取个人资料
向 POST /v1/profile 发送一个网址。请求会等待个人资料被实时读取,通常只需几秒。
curl -X POST https://api.profilehunt.dev/v1/profile \
-H "Authorization: Bearer $PROFILEHUNT_KEY" \
-H "Content-Type: application/json" \
-d '{ "url": "https://www.linkedin.com/in/satyanadella" }'
返回的是 HTTP 200 加上 status:ok(扣 1 个点数)、gone 或 unavailable(两者均免费)。不是 linkedin.com/in/ 个人资料的网址会收到 422 invalid_url,同样免费。对于名单,批量 API 每次请求最多接受 100 个网址。
步骤 2:挑选当前职位
按 end_date 为 null 筛选 experience。以下是首页示例资料的真实结果,已裁剪为工作经历数组:
"experience": [
{ "company": "Microsoft", "company_url": "https://www.linkedin.com/company/microsoft",
"title": "Chairman and CEO", "start_date": "2014-02", "end_date": null },
{ "company": "University of Chicago", "company_url": "https://www.linkedin.com/school/uchicago/",
"title": "Member Board Of Trustees", "start_date": "2018", "end_date": null },
{ "company": "Starbucks", "company_url": "https://www.linkedin.com/company/starbucks",
"title": null, "start_date": "2017", "end_date": "2024" }
]
这份资料有两个当前职位和一个过去的职位。过去的职位 title 为 null,因为 LinkedIn 的公开视图不显示过去职位的头衔。第二个当前职位链接的是 /school/ 页面,而不是 /company/ 页面。这两个细节在步骤 3 中都很重要。
步骤 3:把个人与公司记录关联起来
把每个当前职位的 company_url 发送到 POST /v1/company。该接口接受按名称或数字 ID 寻址的 linkedin.com/company/ 网址,并以每找到一家公司 1 个点数的价格,以 JSON 返回雇主的公开主页。
curl -X POST https://api.profilehunt.dev/v1/company \
-H "Authorization: Bearer $PROFILEHUNT_KEY" \
-H "Content-Type: application/json" \
-d '{ "url": "https://www.linkedin.com/company/hubspot" }'
该主页的真实响应(已裁剪):
{
"status": "ok",
"company": {
"public_id": "hubspot",
"company_url": "https://www.linkedin.com/company/hubspot",
"name": "HubSpot",
"website": "https://hubspot.com",
"industry": "Software Development",
"company_size": "5,001-10,000 employees",
"employees_on_linkedin": 12258,
"headquarters": "Cambridge, Massachusetts",
"country": "US",
"founded": "2006",
"scraped_at": "2026-11-05T13:00:00.000Z"
}
}
像上面 University of Chicago 的职位那样的 /school/ 网址会收到 422 invalid_url,且不计费。发送之前请先检查路径。完整字段列表见公司接口参考,公司数据指南则更深入地介绍了公司记录本身。

Python:当前职位加雇主,完成关联
这个脚本读取个人资料,保留每一个当前职位,对每个雇主只查询一次,并为每人输出一行关联后的记录。名单中很多人共享同一雇主,公司缓存可以节省点数和请求次数。
import os, time, requests
API = "https://api.profilehunt.dev/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['PROFILEHUNT_KEY']}"}
def lookup(kind, url):
"""kind is 'profile' or 'company'. Returns the object, or None if not found."""
while True:
r = requests.post(f"{API}/{kind}", json={"url": url}, headers=HEADERS, timeout=120)
if r.status_code == 429: # 60 requests/minute per key
time.sleep(int(r.headers.get("Retry-After", "30")))
continue
if r.status_code == 422: # not a profile/company URL, not charged
return None
r.raise_for_status()
body = r.json()
return body[kind] if body["status"] == "ok" else None
def current_roles(profile):
return [e for e in profile["experience"] if e["end_date"] is None]
def is_company_page(url):
return bool(url) and "linkedin.com/company/" in url
companies = {} # company_url -> company object (or None)
def company_for(url):
if url not in companies:
companies[url] = lookup("company", url)
return companies[url]
def enrich(linkedin_url):
p = lookup("profile", linkedin_url)
if p is None:
return {"linkedin_url": linkedin_url, "found": False}
roles = current_roles(p)
main = roles[0] if roles else None
url = main["company_url"] if main else None
c = company_for(url) if is_company_page(url) else None
return {
"linkedin_url": linkedin_url,
"found": True,
"current_title": main["title"] if main else None,
"current_company": main["company"] if main else None,
"current_company_url": url,
"other_current_roles": [r["company"] for r in roles[1:]],
"company_industry": c["industry"] if c else None,
"company_size": c["company_size"] if c else None,
"company_country": c["country"] if c else None,
"company_website": c["website"] if c else None,
"scraped_at": p["scraped_at"],
}
print(enrich("https://www.linkedin.com/in/satyanadella"))
对于超过几百行的数据,请把个人资料通过 POST /v1/profile/batches 发送,把公司通过 POST /v1/company/batches 发送,每批 100 个网址。创建一个批次计为一次请求,计入速率限制;轮询则不收费。Python 解析指南讲解了如何将个人资料的其余部分展平。
会让当前职位代码出错的边界情况
当前雇主相关的管道中,大多数错误来自以下五种情况。每种都真实存在,每种都有一条简单的处理规则。
| 情况 | JSON 的样子 | 处理规则 |
|---|---|---|
| 多个当前职位 | 两个或更多 end_date: null 的经历 | 把第一个作为主要职位,其余保存在列表中。 |
| 职位被隐藏 | 当前职位的 title: null | 存储 null。不要把它当作变动或降职。 |
| 自由职业或个人经营 | company 是填写的文字,company_url 通常为 null | 没有可关联的公司主页;保留文字,跳过公司查询。 |
| 没有当前职位 | 没有 end_date: null 的经历 | 可能是待业中,或经历被隐藏。不要用过去的雇主来填充。 |
| 过期的自定义网址 | 原本有效的网址返回 gone | 成员可能修改了个人资料网址。该请求不计费;请找到新网址。 |
多个当前职位
董事会席位、顾问职位、创始人兼任的副业公司:真实资料中常常包含多个当前职位。以比尔·盖茨的首页示例为例,他的资料列出了三个当前职位,每个都是 end_date: null:盖茨基金会联合主席、突破能源(Breakthrough Energy)创始人,以及微软联合创始人。"当前"指的是资料上没有结束日期,并不代表这是此人的主要工作。
隐藏的职位返回 null
LinkedIn 会对未登录访问者隐藏某些信息。职位被隐藏时,ProfileHunt 返回的是 null,而不是占位符或猜测。你的代码应把 null 视为"未知",并保留你已经持有的职位,除非你另行决定。
过期的自定义网址
成员可以修改个人资料网址中 /in/ 之后的名称。CRM 中的旧网址因此通常会返回 gone,且不收费。注意 public_id 只是回显你发送的网址中的名称,它无法告诉你新网址是什么。
步骤 4:随时间检测职位变动
职位变动是同一份资料两次读取之间,当前雇主集合的差异。比较 company_url 的值,因为它不会因拼写而变化;当某个职位没有主页时,则退而比较标准化后的公司名称。
// Node 18+: compare the current employers of two reads of one profile.
const key = r => r.company_url ?? r.company.toLowerCase().replace(/[,.]|\b(inc|llc|ltd|gmbh)\b/g, "").trim();
const current = p => p.experience.filter(e => e.end_date === null);
export async function readProfile(url) {
const res = await fetch("https://api.profilehunt.dev/v1/profile", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PROFILEHUNT_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ url }),
});
if (!res.ok) throw new Error(`ProfileHunt ${res.status}`);
const body = await res.json();
return body.status === "ok" ? body.profile : null; // gone/unavailable: free, compare nothing
}
export function jobChange(before, after) {
const was = new Map(current(before).map(r => [key(r), r]));
const now = new Map(current(after).map(r => [key(r), r]));
const joined = [...now.keys()].filter(k => !was.has(k)).map(k => now.get(k));
const left = [...was.keys()].filter(k => !now.has(k)).map(k => was.get(k));
return joined.length || left.length ? { joined, left, checked_at: after.scraped_at } : null;
}
为每个人保存最近一次 ok 的个人资料,按你的计划再次读取,然后运行 jobChange。结果中出现 joined 职位,即表示有新雇主;它的 start_date 能告诉你变动的时间有多近。当某次读取返回 gone 或 unavailable 时,跳过比较:没有数据不等于职位变动。

如果你不想自己运行这个计划,ProfileHunt 仪表板中的 Monitors 可以按小时到每周的间隔重新检查一份个人资料,并在其工作经历、标题或其他字段发生变化时发送 Webhook。职位变动提醒用例展示了这一工作流在 CRM 端的做法。
关于企业当前数据的常见误区
"标题就是当前工作。" 标题是成员自己撰写的自由文本。比尔·盖茨样本的标题写的是"Chair, Gates Foundation",而工作经历中写的是"Co-chair"。应从 experience 中映射职位,把标题当作背景参考。
"取开始日期最新的那一个。" 这会让最近的副业盖过长期的主要工作。在盖茨样本中,它会选择突破能源(2015 年)而不是盖茨基金会(2000 年)。列在最前面的当前职位是更好的默认值。
"每个 company_url 都是一家公司。" 当前职位可能链接到 /school/ 页面,正如 University of Chicago 的董事职位所示。调用公司接口之前,请按 /company/ 进行筛选。
误区与事实
| 误区 | 事实 |
|---|---|
| 职位为空意味着 API 失败了。 | 状态为 ok;只是资料没有公开显示职位。 |
| 按公司名称匹配就够了。 | "Microsoft"、"Microsoft Corp." 和 "MSFT" 在 CRM 中都会出现。company_url 对每个公司主页只有一个值。 |
| 获取当前雇主需要登录会话。 | 当前雇主、职位和日期属于公开视图的一部分,除非成员将其隐藏。 |
| 缓存个人资料几个月以节省费用。 | 按每找到 1,000 条 0.50 美元计算,重新读取很便宜;过时的雇主信息才会让你付出代价。 |
进阶:大规模运行当前雇主数据
本节适用于已经在为数千名联系人补全数据的团队。
- 在公司查询之前先对雇主去重。 收集每个当前
company_url,每个只查询一次,然后在你的数据库中关联。一份一万人的名单通常只涉及少得多的雇主。 - 缓存公司,重新读取个人。 公司主页变化缓慢;职位变动才是你付费要获取的信号。按你的计划重新读取个人资料,公司记录则可以较少刷新。ProfileHunt 不做缓存,每次调用都实时读取页面,
scraped_at标明了你副本的时间。 - 保留完整的当前职位列表。 将
experience过滤为end_date: null的结果以 JSON 形式存储,与扁平列放在一起。之后遇到董事会席位或采购决策人的问题时会用到。 - 写入置信度标记。 当主要职位的
title: null时标记为title_hidden,当company_url为null时标记为no_company_page。路由规则可以据此跳过或复核这些行,而不是去猜测。 - 遵守隐私法规。 公开的个人资料数据在 GDPR 等法律下仍可能属于个人数据。只收集你需要的字段,并确定保留的期限。这不是法律建议。
成本
| 任务 | 调用次数 | ProfileHunt API 的成本 |
|---|---|---|
| 1 万个个人资料的当前职位 | 10,000 次个人资料查询 | 最多 5.00 美元(只对找到的个人资料计费) |
| 2,000 家不重复公司的雇主记录 | 2,000 次公司查询 | 最多 1.00 美元 |
| 每月对 5,000 位联系人进行职位变动检查 | 每月 5,000 次个人资料查询 | 每月最多 2.50 美元 |
ProfileHunt 直连 API 每千个个人资料 0.50 美元:1 美元购买 2,000 个点数,未找到的个人资料免费。ProfileHunt 在 Apify 上的个人资料 actor 每找到一千个收费 2 美元,并且每一行都带有扁平的当前职位列。ProfileHunt 是独立服务,与 LinkedIn 没有关联,也未获得 LinkedIn 的认可或赞助。
开始使用
通过快速开始创建密钥,使用工作邮箱可获得 100 个免费点数。先获取几份个人资料,按 end_date: null 筛选 experience,再通过公司接口关联雇主。对于个人资料上的其他字段,请随时参考 LinkedIn 个人资料 JSON 结构。
常见问题
如何从 LinkedIn 个人资料网址获取某人当前的雇主?
将网址发送给 LinkedIn 个人资料 API,例如 ProfileHunt,然后在 experience 数组中筛选 end_date: null 的职位。每个职位都有 company、company_url 和 title。在大多数情况下,第一个就是此人的主要当前职位。
有没有能从 LinkedIn 获取当前职位名称的 API?
有。ProfileHunt 在 experience 中为每个当前职位返回 title,ProfileHunt Apify actor 还会添加扁平的 current_title 列。如果个人资料对未登录访问者隐藏了职位,该字段为 null。
为什么当前职位名称是 null?
成员的公开个人资料不会向未登录用户显示它。查询本身仍然成功,状态为 ok,而且在公开视图中过去的职位从不带有职位名称。
如果某人有多个当前工作怎么办?
每个 end_date: null 的职位都算当前职位。全部保留;对于只能填一个值的 CRM 字段,使用列在最前面的那个作为主要职位。
如何获取某人雇主的公司数据?
取该当前职位的 company_url,发送到 POST /v1/company。你将获得行业、规模区间、LinkedIn 上的员工数、总部、国家和官网,每找到一家公司扣 1 个点数。参见公司接口参考。
如何自动检测 LinkedIn 职位变动?
存储每个个人资料的当前 company_url,按计划重新读取,一旦出现新公司就标记该联系人。新职位的 start_date 可以确定变动的时间。ProfileHunt 仪表板中的 Monitors 可以运行这一计划并发送 Webhook。
获取 LinkedIn 当前公司数据是否需要 LinkedIn 账户?
不需要。ProfileHunt 只读取任何未登录访问者都能看到的公开个人资料,不使用 LinkedIn 账户、Cookie 或会话。


