linkedin-relay-mcp 3.25.0 → 3.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/linkedin-relay/SKILL.md +24 -9
- package/README.md +3 -1
- package/dist/cli.js +600 -299
- package/dist/cli.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/mcp-shim.js +527 -229
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
package/dist/mcp-shim.js
CHANGED
|
@@ -795,6 +795,24 @@ var CONTRACTS = {
|
|
|
795
795
|
provenance: "verified",
|
|
796
796
|
capturedAt: "2026-10-14"
|
|
797
797
|
},
|
|
798
|
+
// Premium job reads, captured 2026-11-22 from /jobs/collections/top-applicant/
|
|
799
|
+
// and a job's detail pane. See engine/job-premium.ts.
|
|
800
|
+
jobCollection: {
|
|
801
|
+
name: "jobCollection",
|
|
802
|
+
transport: "voyager-graphql",
|
|
803
|
+
path: `${VOYAGER}/graphql`,
|
|
804
|
+
queryId: "voyagerJobsDashJobCards.fc1f897bcf2dc9afd5184ef3e9ed589b",
|
|
805
|
+
provenance: "verified",
|
|
806
|
+
capturedAt: "2026-11-22"
|
|
807
|
+
},
|
|
808
|
+
jobDetailSections: {
|
|
809
|
+
name: "jobDetailSections",
|
|
810
|
+
transport: "voyager-graphql",
|
|
811
|
+
path: `${VOYAGER}/graphql`,
|
|
812
|
+
queryId: "voyagerJobsDashJobPostingDetailSections.bc2eee77d01abc6616b8c8855344dfd5",
|
|
813
|
+
provenance: "verified",
|
|
814
|
+
capturedAt: "2026-11-22"
|
|
815
|
+
},
|
|
798
816
|
jobPosting: {
|
|
799
817
|
name: "jobPosting",
|
|
800
818
|
transport: "voyager-restli",
|
|
@@ -869,25 +887,25 @@ function parseCompany(json) {
|
|
|
869
887
|
const data = root?.data;
|
|
870
888
|
if (data === void 0 || data === null) return drift("the company answer carried no data");
|
|
871
889
|
const included = root?.included ?? [];
|
|
872
|
-
const
|
|
890
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
873
891
|
let c = data;
|
|
874
892
|
if (!String(data.$type ?? "").endsWith("organization.Company")) {
|
|
875
893
|
const listed = urns(data["*elements"]);
|
|
876
894
|
if (listed.length === 0)
|
|
877
895
|
return { ok: false, code: "NOT_FOUND", message: "no company has that name on LinkedIn" };
|
|
878
|
-
c =
|
|
896
|
+
c = byUrn2.get(listed[0]);
|
|
879
897
|
if (c === void 0) return drift("the company was listed but not sent");
|
|
880
898
|
}
|
|
881
899
|
const id = idOf(c.entityUrn);
|
|
882
900
|
const name = str(c.name);
|
|
883
901
|
if (id === void 0 || name === void 0) return drift("the company carried no id or name");
|
|
884
902
|
const followersOf = (n) => {
|
|
885
|
-
const f =
|
|
903
|
+
const f = byUrn2.get(n["*followingInfo"]);
|
|
886
904
|
return typeof f?.followerCount === "number" ? f.followerCount : void 0;
|
|
887
905
|
};
|
|
888
906
|
const related = (list) => {
|
|
889
907
|
const pages = urns(list).flatMap((u) => {
|
|
890
|
-
const p =
|
|
908
|
+
const p = byUrn2.get(u);
|
|
891
909
|
const pid = idOf(u);
|
|
892
910
|
const pname = str(p?.name);
|
|
893
911
|
if (p === void 0 || pid === void 0 || pname === void 0) return [];
|
|
@@ -895,7 +913,7 @@ function parseCompany(json) {
|
|
|
895
913
|
});
|
|
896
914
|
return pages.length > 0 ? pages : void 0;
|
|
897
915
|
};
|
|
898
|
-
const industry = urns(c["*companyIndustries"]).map((u) => str(
|
|
916
|
+
const industry = urns(c["*companyIndustries"]).map((u) => str(byUrn2.get(u)?.localizedName)).find((x) => x !== void 0);
|
|
899
917
|
const locations = (Array.isArray(c.confirmedLocations) ? c.confirmedLocations : []).map(address).filter((x) => x !== void 0);
|
|
900
918
|
const specialties = Array.isArray(c.specialities) ? c.specialities.filter((x) => typeof x === "string") : [];
|
|
901
919
|
const founded = c.foundedOn?.year;
|
|
@@ -1095,6 +1113,7 @@ function classifyRedirect(location) {
|
|
|
1095
1113
|
return fail("FETCH_FAILED", `unexpected redirect to ${location || "(none)"}`);
|
|
1096
1114
|
}
|
|
1097
1115
|
function challengeIn(body) {
|
|
1116
|
+
if (!/^\s*</.test(body)) return null;
|
|
1098
1117
|
if (!CHALLENGE_MARKERS.test(body.slice(0, 4e3))) return null;
|
|
1099
1118
|
return fail("CHALLENGE_DETECTED", "a challenge page was returned with status 200", {
|
|
1100
1119
|
cooldown: "CHALLENGE_DETECTED",
|
|
@@ -1414,9 +1433,9 @@ function findRefs(data) {
|
|
|
1414
1433
|
}
|
|
1415
1434
|
function parseSingle(payload) {
|
|
1416
1435
|
const envelope = payload ?? {};
|
|
1417
|
-
const
|
|
1418
|
-
if (
|
|
1419
|
-
return
|
|
1436
|
+
const nodes2 = [...new Set(indexIncluded(envelope.included).values())];
|
|
1437
|
+
if (nodes2.length === 0) return void 0;
|
|
1438
|
+
return nodes2.find((n) => !isNoise(n) && !isDecoration(n)) ?? nodes2[0];
|
|
1420
1439
|
}
|
|
1421
1440
|
function parseCollection(payload, opts) {
|
|
1422
1441
|
const envelope = payload ?? {};
|
|
@@ -1826,10 +1845,10 @@ function balanced(s, start) {
|
|
|
1826
1845
|
return null;
|
|
1827
1846
|
}
|
|
1828
1847
|
function parseAt(s, start) {
|
|
1829
|
-
const
|
|
1830
|
-
if (
|
|
1848
|
+
const text7 = start < 0 ? null : balanced(s, start);
|
|
1849
|
+
if (text7 === null) return null;
|
|
1831
1850
|
try {
|
|
1832
|
-
return JSON.parse(
|
|
1851
|
+
return JSON.parse(text7);
|
|
1833
1852
|
} catch {
|
|
1834
1853
|
return null;
|
|
1835
1854
|
}
|
|
@@ -2194,13 +2213,13 @@ function readPost(rows, top, model) {
|
|
|
2194
2213
|
const subRow = sub === void 0 ? "" : rows.byId.get(sub.row) ?? "";
|
|
2195
2214
|
const posted = sub === void 0 ? void 0 : texts(subRow, subRow.indexOf('"viewName":"feed-actor-sub-description"'))[0];
|
|
2196
2215
|
const said = commentary === void 0 ? void 0 : firstIn(rows, commentary.under, (row) => texts(row)[0]);
|
|
2197
|
-
const
|
|
2216
|
+
const text7 = said?.v;
|
|
2198
2217
|
const post = {
|
|
2199
2218
|
id,
|
|
2200
2219
|
url: `https://www.linkedin.com/feed/update/${id}/`,
|
|
2201
2220
|
...author.fields,
|
|
2202
2221
|
...posted !== void 0 ? { posted } : {},
|
|
2203
|
-
...
|
|
2222
|
+
...text7 !== void 0 ? { text: text7 } : {},
|
|
2204
2223
|
...reactions !== void 0 ? { reactions } : {}
|
|
2205
2224
|
};
|
|
2206
2225
|
const comments = n(`commentCount-${id}`);
|
|
@@ -2340,21 +2359,22 @@ var drift2 = (message) => ({
|
|
|
2340
2359
|
hint: "the job search response changed shape; re-capture it"
|
|
2341
2360
|
});
|
|
2342
2361
|
function readCards(elements, included) {
|
|
2343
|
-
const
|
|
2362
|
+
const byUrn2 = /* @__PURE__ */ new Map();
|
|
2344
2363
|
for (const node of included) {
|
|
2345
|
-
if (typeof node.entityUrn === "string")
|
|
2364
|
+
if (typeof node.entityUrn === "string") byUrn2.set(node.entityUrn, node);
|
|
2346
2365
|
}
|
|
2347
2366
|
const jobs = [];
|
|
2348
2367
|
const unknownTypes = {};
|
|
2349
2368
|
let unresolved = 0;
|
|
2350
2369
|
for (const el of elements) {
|
|
2351
|
-
const union = el.jobCardUnion ?? {};
|
|
2370
|
+
const union = el.jobCardUnion ?? el.jobCard ?? {};
|
|
2352
2371
|
const ref = union["*jobPostingCard"];
|
|
2353
2372
|
if (typeof ref !== "string") {
|
|
2354
|
-
for (const kind of Object.
|
|
2373
|
+
for (const [kind, v] of Object.entries(union))
|
|
2374
|
+
if (v !== null && !kind.startsWith("$")) unknownTypes[kind] = (unknownTypes[kind] ?? 0) + 1;
|
|
2355
2375
|
continue;
|
|
2356
2376
|
}
|
|
2357
|
-
const card2 =
|
|
2377
|
+
const card2 = byUrn2.get(ref);
|
|
2358
2378
|
const job = card2 === void 0 ? void 0 : cardToJob(card2);
|
|
2359
2379
|
if (job === void 0) unresolved++;
|
|
2360
2380
|
else if (!jobs.some((j) => j.id === job.id)) jobs.push(job);
|
|
@@ -2453,10 +2473,10 @@ function parseJobBatch(json) {
|
|
|
2453
2473
|
if (results === null || typeof results !== "object")
|
|
2454
2474
|
return drift2("the batch job response carried no results");
|
|
2455
2475
|
const included = root?.included ?? [];
|
|
2456
|
-
const
|
|
2476
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
2457
2477
|
const jobs = [];
|
|
2458
2478
|
for (const ref of Object.values(results)) {
|
|
2459
|
-
const node = typeof ref === "string" ?
|
|
2479
|
+
const node = typeof ref === "string" ? byUrn2.get(ref) : ref;
|
|
2460
2480
|
const job = node === void 0 ? void 0 : postingToJob(node, included);
|
|
2461
2481
|
if (job !== void 0) jobs.push(job);
|
|
2462
2482
|
}
|
|
@@ -2757,7 +2777,7 @@ function classify2(item) {
|
|
|
2757
2777
|
return kinds.every((k) => FURNITURE.has(k)) ? "furniture" : kinds;
|
|
2758
2778
|
}
|
|
2759
2779
|
function readItems(c, included, toRow) {
|
|
2760
|
-
const
|
|
2780
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
2761
2781
|
const people = [];
|
|
2762
2782
|
const unknownTypes = {};
|
|
2763
2783
|
let excluded = 0;
|
|
@@ -2770,7 +2790,7 @@ function readItems(c, included, toRow) {
|
|
|
2770
2790
|
} else if (Array.isArray(kind)) {
|
|
2771
2791
|
for (const k of kind) unknownTypes[k] = (unknownTypes[k] ?? 0) + 1;
|
|
2772
2792
|
} else {
|
|
2773
|
-
const row =
|
|
2793
|
+
const row = byUrn2.get(kind.ref);
|
|
2774
2794
|
const person = row === void 0 ? void 0 : toRow(row);
|
|
2775
2795
|
if (person === void 0) unresolved++;
|
|
2776
2796
|
else if (!people.some((p) => p.id === person.id)) people.push(person);
|
|
@@ -2850,11 +2870,11 @@ function parseOrgHits(json) {
|
|
|
2850
2870
|
const c = clustersOf(json);
|
|
2851
2871
|
if (c === void 0) return drift3("the organisation search returned no result list");
|
|
2852
2872
|
const included = json.included ?? [];
|
|
2853
|
-
const
|
|
2873
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
2854
2874
|
const hits = [];
|
|
2855
2875
|
for (const el of c.elements ?? []) {
|
|
2856
2876
|
for (const { item } of el.items ?? []) {
|
|
2857
|
-
const row =
|
|
2877
|
+
const row = byUrn2.get(item?.["*entityResult"]);
|
|
2858
2878
|
const id = String(row?.entityUrn ?? "").match(/urn:li:fsd_company:(\d+)/)?.[1];
|
|
2859
2879
|
const name = text3(row?.title);
|
|
2860
2880
|
if (id !== void 0 && name !== void 0 && !hits.some((h) => h.id === id))
|
|
@@ -3261,13 +3281,13 @@ function compactPost(p) {
|
|
|
3261
3281
|
p.comments !== void 0 ? `${p.comments} comments` : void 0,
|
|
3262
3282
|
p.reposts !== void 0 ? `${p.reposts} reposts` : void 0
|
|
3263
3283
|
].filter(Boolean);
|
|
3264
|
-
const
|
|
3284
|
+
const text7 = p.text?.replace(/\s+/g, " ");
|
|
3265
3285
|
return line([
|
|
3266
3286
|
p.id,
|
|
3267
3287
|
p.author,
|
|
3268
3288
|
p.posted,
|
|
3269
3289
|
counts2.length > 0 ? counts2.join(" \xB7 ") : void 0,
|
|
3270
|
-
|
|
3290
|
+
text7 !== void 0 && text7.length > 160 ? `${text7.slice(0, 157)}\u2026` : text7,
|
|
3271
3291
|
p.url,
|
|
3272
3292
|
p.matched !== void 0 ? `matched: ${p.matched.join(" + ")}` : void 0
|
|
3273
3293
|
]);
|
|
@@ -3519,14 +3539,14 @@ var txt = (v) => {
|
|
|
3519
3539
|
if (t !== null && typeof t === "object") return txt(t);
|
|
3520
3540
|
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
3521
3541
|
};
|
|
3522
|
-
function organizerOf(e,
|
|
3542
|
+
function organizerOf(e, byUrn2) {
|
|
3523
3543
|
const o = e.organizer ?? {};
|
|
3524
|
-
const company =
|
|
3544
|
+
const company = byUrn2.get(o["*organizingCompanyUrn"]);
|
|
3525
3545
|
if (typeof company?.name === "string") {
|
|
3526
3546
|
const id = String(company.entityUrn).split(":").pop();
|
|
3527
3547
|
return { name: company.name, kind: "company", url: `https://www.linkedin.com/company/${id}/` };
|
|
3528
3548
|
}
|
|
3529
|
-
const person =
|
|
3549
|
+
const person = byUrn2.get(o["*organizingProfileUrn"] ?? o.organizingProfileUrn);
|
|
3530
3550
|
const name = [person?.firstName, person?.lastName].filter((x) => typeof x === "string").join(" ");
|
|
3531
3551
|
if (name !== "") {
|
|
3532
3552
|
const vanity = person?.publicIdentifier;
|
|
@@ -3550,11 +3570,11 @@ function parseEvent(json) {
|
|
|
3550
3570
|
hint: "re-capture the event page"
|
|
3551
3571
|
};
|
|
3552
3572
|
}
|
|
3553
|
-
const
|
|
3573
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
3554
3574
|
const range2 = e.timeRange ?? {};
|
|
3555
3575
|
const address2 = e.address ?? null;
|
|
3556
3576
|
const place = address2 === null ? void 0 : [address2.city, address2.geographicArea, address2.country].filter((x) => typeof x === "string" && x !== "").join(", ");
|
|
3557
|
-
const status =
|
|
3577
|
+
const status = byUrn2.get(e["*viewerStatus"])?.scheduledContentViewerStatus;
|
|
3558
3578
|
const attendees = Number(
|
|
3559
3579
|
txt(e.socialProof)?.match(/^(\d[\d,.\s]*)/)?.[1]?.replace(/[,.\s]/g, "")
|
|
3560
3580
|
);
|
|
@@ -3577,7 +3597,7 @@ function parseEvent(json) {
|
|
|
3577
3597
|
set("state", typeof e.lifecycleState === "string" ? e.lifecycleState : void 0);
|
|
3578
3598
|
if (e.cancelled === true) out.cancelled = true;
|
|
3579
3599
|
set("attendees", Number.isFinite(attendees) ? attendees : void 0);
|
|
3580
|
-
set("organizer", organizerOf(e,
|
|
3600
|
+
set("organizer", organizerOf(e, byUrn2));
|
|
3581
3601
|
set("place", place);
|
|
3582
3602
|
set("site", typeof e.externalUrl === "string" ? e.externalUrl : void 0);
|
|
3583
3603
|
if (e.privateEvent === true) out.private = true;
|
|
@@ -3685,6 +3705,158 @@ async function runEvent(inputs, opts = {}, fetch2) {
|
|
|
3685
3705
|
});
|
|
3686
3706
|
}
|
|
3687
3707
|
|
|
3708
|
+
// src/engine/job-premium.ts
|
|
3709
|
+
function graphql(name) {
|
|
3710
|
+
const c = CONTRACTS[name];
|
|
3711
|
+
if (c?.queryId === void 0) throw new Error(`job contract '${name}' is missing`);
|
|
3712
|
+
return { path: c.path, queryId: c.queryId };
|
|
3713
|
+
}
|
|
3714
|
+
var COLLECTION_PAGE = 100;
|
|
3715
|
+
function jobCollectionUrl(slug, start, count3) {
|
|
3716
|
+
const c = graphql("jobCollection");
|
|
3717
|
+
const variables = `(count:${count3},jobCollectionSlug:${slug},query:(origin:GENERIC_JOB_COLLECTIONS_LANDING),start:${start})`;
|
|
3718
|
+
return `${c.path}?variables=${variables}&queryId=${c.queryId}`;
|
|
3719
|
+
}
|
|
3720
|
+
function jobInsightsUrl(id) {
|
|
3721
|
+
const c = graphql("jobDetailSections");
|
|
3722
|
+
const urn = encodeURIComponent(`urn:li:fsd_jobPosting:${id}`);
|
|
3723
|
+
const variables = `(cardSectionTypes:List(JOB_APPLICANT_INSIGHTS,COMPANY_INSIGHTS_CARD),jobPostingUrn:${urn},includeSecondaryActionsV2:true)`;
|
|
3724
|
+
return `${c.path}?includeWebMetadata=true&variables=${variables}&queryId=${c.queryId}`;
|
|
3725
|
+
}
|
|
3726
|
+
var drift4 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
3727
|
+
var text4 = (v) => {
|
|
3728
|
+
const t = v?.text;
|
|
3729
|
+
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
3730
|
+
};
|
|
3731
|
+
var nodes = (v) => Array.isArray(v) ? v : [];
|
|
3732
|
+
function defined5(obj) {
|
|
3733
|
+
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
3734
|
+
return obj;
|
|
3735
|
+
}
|
|
3736
|
+
function parseJobCollection(json) {
|
|
3737
|
+
const root = json;
|
|
3738
|
+
const collection2 = root?.data?.data?.jobsDashJobCardsByJobCollections;
|
|
3739
|
+
if (collection2 === void 0 || collection2 === null) {
|
|
3740
|
+
const why = nodes(root?.data?.errors)[0]?.message;
|
|
3741
|
+
return drift4(`the job collection was not served${typeof why === "string" ? `: ${why}` : ""}`);
|
|
3742
|
+
}
|
|
3743
|
+
return parseJobCards({ data: collection2, included: root?.included ?? [] });
|
|
3744
|
+
}
|
|
3745
|
+
function byUrn(included) {
|
|
3746
|
+
const map = /* @__PURE__ */ new Map();
|
|
3747
|
+
for (const n of included) if (typeof n.entityUrn === "string") map.set(n.entityUrn, n);
|
|
3748
|
+
return map;
|
|
3749
|
+
}
|
|
3750
|
+
var nameOf = (urns2, urn) => {
|
|
3751
|
+
const n = typeof urn === "string" ? urns2.get(urn)?.name : void 0;
|
|
3752
|
+
return typeof n === "string" ? n : void 0;
|
|
3753
|
+
};
|
|
3754
|
+
function applicantsOf(a, urns2) {
|
|
3755
|
+
const seniority = nodes(a.seniorityDetails).flatMap((s) => {
|
|
3756
|
+
const level = nameOf(urns2, s["*seniority"]);
|
|
3757
|
+
return level === void 0 || typeof s.percentage !== "number" ? [] : [defined5({ level, share: s.percentage, count: s.count })];
|
|
3758
|
+
});
|
|
3759
|
+
const education = nodes(a.degreeDetails).flatMap((d) => {
|
|
3760
|
+
const degree = nameOf(urns2, d["*degree"]);
|
|
3761
|
+
return degree === void 0 || typeof d.percentage !== "number" ? [] : [{ degree, share: d.percentage }];
|
|
3762
|
+
});
|
|
3763
|
+
const skills = nodes(a.skillDetails);
|
|
3764
|
+
const locations = nodes(a.locationDetails);
|
|
3765
|
+
return defined5({
|
|
3766
|
+
total: a.applicantCount,
|
|
3767
|
+
lastDay: typeof a.applicantsInPastDay === "number" ? a.applicantsInPastDay : void 0,
|
|
3768
|
+
seniority: seniority.length > 0 ? seniority : void 0,
|
|
3769
|
+
education: education.length > 0 ? education : void 0,
|
|
3770
|
+
rankPercentile: typeof a.applicantRankPercentile === "number" ? a.applicantRankPercentile : void 0,
|
|
3771
|
+
skills: skills.length > 0 ? skills : void 0,
|
|
3772
|
+
locations: locations.length > 0 ? locations : void 0
|
|
3773
|
+
});
|
|
3774
|
+
}
|
|
3775
|
+
function headcountOf(growth) {
|
|
3776
|
+
const months = nodes(growth?.headcountGrowth).flatMap((m) => {
|
|
3777
|
+
const on = m.startedOn;
|
|
3778
|
+
return typeof m.employeeCount === "number" && on?.year !== void 0 && on.month !== void 0 ? [{ month: `${on.year}-${String(on.month).padStart(2, "0")}`, count: m.employeeCount }] : [];
|
|
3779
|
+
});
|
|
3780
|
+
const latest = months[0];
|
|
3781
|
+
if (latest === void 0) return void 0;
|
|
3782
|
+
const back = (n) => months[n]?.count;
|
|
3783
|
+
const yearAgo = back(12);
|
|
3784
|
+
return defined5({
|
|
3785
|
+
asOf: latest.month,
|
|
3786
|
+
now: latest.count,
|
|
3787
|
+
sixMonthsAgo: back(6),
|
|
3788
|
+
yearAgo,
|
|
3789
|
+
twoYearsAgo: back(24),
|
|
3790
|
+
growth1y: yearAgo !== void 0 && yearAgo > 0 ? Math.round((latest.count - yearAgo) / yearAgo * 1e3) / 10 : void 0
|
|
3791
|
+
});
|
|
3792
|
+
}
|
|
3793
|
+
var str3 = (v) => typeof v === "string" ? v : void 0;
|
|
3794
|
+
function trendOf(s, urns2) {
|
|
3795
|
+
const company = urns2.get(String(s["*company"]));
|
|
3796
|
+
const fn = str3(s.formattedJobFunction);
|
|
3797
|
+
return defined5({
|
|
3798
|
+
name: str3(company?.name),
|
|
3799
|
+
url: str3(company?.url),
|
|
3800
|
+
headcount: headcountOf(s.employeeGrowth),
|
|
3801
|
+
function: fn !== void 0 ? { name: fn, ...headcountOf(s.employeeGrowthForFunction) } : void 0,
|
|
3802
|
+
medianTenure: text4(s.employeeGrowth?.medianTenureYears)
|
|
3803
|
+
});
|
|
3804
|
+
}
|
|
3805
|
+
function landscapeOf(s) {
|
|
3806
|
+
const competitors = nodes(s.competitors).flatMap((c) => {
|
|
3807
|
+
const name = text4(c.title);
|
|
3808
|
+
return name === void 0 ? [] : [defined5({ name, industry: text4(c.subtitle), url: str3(c.navigationUrl) })];
|
|
3809
|
+
});
|
|
3810
|
+
return defined5({
|
|
3811
|
+
landscape: text4(s.aiqInsightsText),
|
|
3812
|
+
competitors: competitors.length > 0 ? competitors : void 0
|
|
3813
|
+
});
|
|
3814
|
+
}
|
|
3815
|
+
var SECTIONS = {
|
|
3816
|
+
jobPostingCompanyInsights: trendOf,
|
|
3817
|
+
headcountAIQInsights: (s) => defined5({ hiring: text4(s.aiqInsightsText) }),
|
|
3818
|
+
strategicPrioritiesAIQInsights: (s) => defined5({ priorities: text4(s.insightsText) }),
|
|
3819
|
+
competitiveLandscapeAIQInsights: landscapeOf
|
|
3820
|
+
};
|
|
3821
|
+
function companyOf(card2, urns2, unknown) {
|
|
3822
|
+
const out = {};
|
|
3823
|
+
for (const el of nodes(card2.elements)) {
|
|
3824
|
+
for (const [kind, section] of Object.entries(el.companyInsights ?? {})) {
|
|
3825
|
+
if (section === null || kind.startsWith("$")) continue;
|
|
3826
|
+
const read = SECTIONS[kind];
|
|
3827
|
+
if (read === void 0) unknown[kind] = (unknown[kind] ?? 0) + 1;
|
|
3828
|
+
else Object.assign(out, read(section, urns2));
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3831
|
+
return out;
|
|
3832
|
+
}
|
|
3833
|
+
function parseJobInsights(json) {
|
|
3834
|
+
const root = json;
|
|
3835
|
+
const sections = root?.data?.data?.jobsDashJobPostingDetailSectionsByCardSectionTypes;
|
|
3836
|
+
if (sections === void 0 || sections === null || !Array.isArray(sections.elements))
|
|
3837
|
+
return drift4("the job detail sections were not in the answer");
|
|
3838
|
+
const urns2 = byUrn(root?.included ?? []);
|
|
3839
|
+
const unknownSections = {};
|
|
3840
|
+
let applicants;
|
|
3841
|
+
let company;
|
|
3842
|
+
for (const el of nodes(sections.elements)) {
|
|
3843
|
+
for (const part2 of nodes(el.jobPostingDetailSection)) {
|
|
3844
|
+
const a = urns2.get(String(part2["*jobApplicantInsightsUrn"]));
|
|
3845
|
+
if (a !== void 0 && typeof a.applicantCount === "number")
|
|
3846
|
+
applicants = applicantsOf(a, urns2);
|
|
3847
|
+
const posting = urns2.get(String(part2["*companyInsightsCard"]));
|
|
3848
|
+
const card2 = posting?.companyInsightsCard;
|
|
3849
|
+
if (card2 !== void 0 && card2 !== null) company = companyOf(card2, urns2, unknownSections);
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
return {
|
|
3853
|
+
ok: true,
|
|
3854
|
+
...applicants !== void 0 ? { applicants } : {},
|
|
3855
|
+
...company !== void 0 && Object.keys(company).length > 0 ? { company } : {},
|
|
3856
|
+
unknownSections
|
|
3857
|
+
};
|
|
3858
|
+
}
|
|
3859
|
+
|
|
3688
3860
|
// src/commands/jobs.ts
|
|
3689
3861
|
function liveFetch5(command, quiet) {
|
|
3690
3862
|
const session = loadSession();
|
|
@@ -3761,6 +3933,7 @@ async function addDetails(get, rows, withDescription) {
|
|
|
3761
3933
|
return read.stoppedBy === void 0 ? { unread } : { unread, stoppedBy: read.stoppedBy };
|
|
3762
3934
|
}
|
|
3763
3935
|
async function runJobs(req, opts = {}, fetch2) {
|
|
3936
|
+
if (req.collection !== void 0) return runCollection(req, req.collection, opts, fetch2);
|
|
3764
3937
|
const sets = keywordSets(req.keywords);
|
|
3765
3938
|
const hasQuery = sets.length > 0 || [req.location, req.geoId].some((v) => v !== void 0 && v !== "");
|
|
3766
3939
|
if (!hasQuery) {
|
|
@@ -3827,6 +4000,65 @@ async function runJobs(req, opts = {}, fetch2) {
|
|
|
3827
4000
|
meta
|
|
3828
4001
|
});
|
|
3829
4002
|
}
|
|
4003
|
+
async function runCollection(req, collection2, opts, fetch2) {
|
|
4004
|
+
const searched = keywordSets(req.keywords).length > 0 || req.location || req.geoId;
|
|
4005
|
+
const selection3 = jobFilterSelection(req.filter ?? {});
|
|
4006
|
+
const filtered = !selection3.ok || Object.keys(selection3.filters).length > 0;
|
|
4007
|
+
if (searched || filtered)
|
|
4008
|
+
return err(
|
|
4009
|
+
"jobs",
|
|
4010
|
+
"INVALID_INPUT",
|
|
4011
|
+
`--${collection2} is LinkedIn's own list: it takes no keywords, location or filters`
|
|
4012
|
+
);
|
|
4013
|
+
const get = fetch2 ?? liveFetch5("jobs", opts.quiet === true);
|
|
4014
|
+
if (typeof get !== "function") return get;
|
|
4015
|
+
const first = Math.max(0, req.start ?? 0);
|
|
4016
|
+
const want = Math.max(1, Math.min(req.limit, PAGING3.max - first));
|
|
4017
|
+
const fetchPage = async (_keywords, start) => {
|
|
4018
|
+
const res = await get(jobCollectionUrl(collection2, start, COLLECTION_PAGE), "jobSearch");
|
|
4019
|
+
const page = res.ok ? parseJobCollection(res.json) : res;
|
|
4020
|
+
if (!page.ok) return page;
|
|
4021
|
+
return {
|
|
4022
|
+
ok: true,
|
|
4023
|
+
items: page.jobs,
|
|
4024
|
+
...page.total !== void 0 ? { total: page.total } : {},
|
|
4025
|
+
unknownTypes: page.unknownTypes
|
|
4026
|
+
};
|
|
4027
|
+
};
|
|
4028
|
+
const merged = await searchAll(fetchPage, [void 0], first, want, PAGING3);
|
|
4029
|
+
if (merged.rows.length === 0 && merged.failure !== void 0) {
|
|
4030
|
+
const f = merged.failure;
|
|
4031
|
+
return err("jobs", f.code, f.message, f.hint);
|
|
4032
|
+
}
|
|
4033
|
+
let extra = {};
|
|
4034
|
+
if (req.details === true) {
|
|
4035
|
+
const added = await addDetails(get, merged.rows, req.description === true);
|
|
4036
|
+
extra = {
|
|
4037
|
+
unread: added.unread,
|
|
4038
|
+
...added.stoppedBy !== void 0 ? { readStop: added.stoppedBy } : {}
|
|
4039
|
+
};
|
|
4040
|
+
}
|
|
4041
|
+
return ok("jobs", {
|
|
4042
|
+
collection: collection2,
|
|
4043
|
+
items: shape2(merged.rows, opts, compactJob),
|
|
4044
|
+
meta: metaOf("jobs", merged, true, first, { unread: 0, ...extra })
|
|
4045
|
+
});
|
|
4046
|
+
}
|
|
4047
|
+
async function addInsights(get, jobs) {
|
|
4048
|
+
for (const job of jobs) {
|
|
4049
|
+
const res = await get(jobInsightsUrl(job.id), "jobRead");
|
|
4050
|
+
const read = res.ok ? parseJobInsights(res.json) : res;
|
|
4051
|
+
if (!read.ok) {
|
|
4052
|
+
job.premiumError = `${read.code}: ${read.message}`;
|
|
4053
|
+
continue;
|
|
4054
|
+
}
|
|
4055
|
+
const { ok: _ok, unknownSections, ...insights } = read;
|
|
4056
|
+
job.premium = {
|
|
4057
|
+
...insights,
|
|
4058
|
+
...Object.keys(unknownSections).length > 0 ? { unknownSections } : {}
|
|
4059
|
+
};
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
3830
4062
|
async function addTeams(get, jobs) {
|
|
3831
4063
|
for (const job of jobs) {
|
|
3832
4064
|
const res = await get(HIRING_TEAM_URL, "page", hiringTeamBody(job.id));
|
|
@@ -3855,8 +4087,10 @@ async function runJob(input, opts = {}, fetch2, req = {}) {
|
|
|
3855
4087
|
if (!res.ok) return err("job", res.code, res.message, res.hint);
|
|
3856
4088
|
const detail = parseJobDetail(res.json);
|
|
3857
4089
|
if (!detail.ok) return err("job", detail.code, detail.message, detail.hint);
|
|
3858
|
-
|
|
3859
|
-
|
|
4090
|
+
const job = detail.job;
|
|
4091
|
+
if (req.team === true) await addTeams(get, [job]);
|
|
4092
|
+
if (req.insights === true) await addInsights(get, [job]);
|
|
4093
|
+
return ok("job", job);
|
|
3860
4094
|
}
|
|
3861
4095
|
const read = await readJobs(get, wanted);
|
|
3862
4096
|
if (read.jobs.size === 0 && read.stoppedBy !== void 0)
|
|
@@ -3864,6 +4098,7 @@ async function runJob(input, opts = {}, fetch2, req = {}) {
|
|
|
3864
4098
|
const unread = wanted.filter((id) => !read.jobs.has(id));
|
|
3865
4099
|
const jobs = wanted.flatMap((id) => read.jobs.get(id) ?? []);
|
|
3866
4100
|
if (req.team === true) await addTeams(get, jobs);
|
|
4101
|
+
if (req.insights === true) await addInsights(get, jobs);
|
|
3867
4102
|
return ok("job", {
|
|
3868
4103
|
items: shape2(
|
|
3869
4104
|
jobs,
|
|
@@ -3939,7 +4174,7 @@ var TEXT = /"viewName":"mini-update-container"[\s\S]*?"textProps":\{[^{}]*?"chil
|
|
|
3939
4174
|
function parseScheduledPage(stream) {
|
|
3940
4175
|
const count3 = stream.match(COUNT2);
|
|
3941
4176
|
if (count3?.[1] === void 0) {
|
|
3942
|
-
return
|
|
4177
|
+
return drift5("the scheduled-posts page carried no post count");
|
|
3943
4178
|
}
|
|
3944
4179
|
const claimedCount = Number(count3[1]);
|
|
3945
4180
|
const posts = [];
|
|
@@ -3950,7 +4185,7 @@ function parseScheduledPage(stream) {
|
|
|
3950
4185
|
posts.push({ urn, scheduledAt: Number(at), text: null });
|
|
3951
4186
|
}
|
|
3952
4187
|
if (claimedCount > 0 && posts.length === 0) {
|
|
3953
|
-
return
|
|
4188
|
+
return drift5(`LinkedIn counts ${claimedCount} scheduled posts but no row could be read`);
|
|
3954
4189
|
}
|
|
3955
4190
|
const texts3 = [...stream.matchAll(TEXT)].map((m) => JSON.parse(`"${m[1]}"`));
|
|
3956
4191
|
if (texts3.length === posts.length) {
|
|
@@ -3960,7 +4195,7 @@ function parseScheduledPage(stream) {
|
|
|
3960
4195
|
}
|
|
3961
4196
|
return { ok: true, claimedCount, posts };
|
|
3962
4197
|
}
|
|
3963
|
-
function
|
|
4198
|
+
function drift5(message) {
|
|
3964
4199
|
return {
|
|
3965
4200
|
ok: false,
|
|
3966
4201
|
code: "SCHEMA_DRIFT",
|
|
@@ -4320,7 +4555,7 @@ var txt2 = (v) => {
|
|
|
4320
4555
|
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
4321
4556
|
};
|
|
4322
4557
|
var iso = (ms) => typeof ms === "number" ? new Date(ms).toISOString() : void 0;
|
|
4323
|
-
function
|
|
4558
|
+
function defined6(obj) {
|
|
4324
4559
|
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
4325
4560
|
return obj;
|
|
4326
4561
|
}
|
|
@@ -4330,7 +4565,7 @@ function participantOf(p) {
|
|
|
4330
4565
|
const m = t.member;
|
|
4331
4566
|
const name = [txt2(m.firstName), txt2(m.lastName)].filter(Boolean).join(" ");
|
|
4332
4567
|
const url = typeof m.profileUrl === "string" ? `${m.profileUrl.replace(/\/$/, "")}/` : void 0;
|
|
4333
|
-
return
|
|
4568
|
+
return defined6({
|
|
4334
4569
|
name: name !== "" ? name : "LinkedIn Member",
|
|
4335
4570
|
kind: "person",
|
|
4336
4571
|
headline: txt2(m.headline),
|
|
@@ -4340,7 +4575,7 @@ function participantOf(p) {
|
|
|
4340
4575
|
}
|
|
4341
4576
|
if (t.organization) {
|
|
4342
4577
|
const o = t.organization;
|
|
4343
|
-
return
|
|
4578
|
+
return defined6({
|
|
4344
4579
|
name: txt2(o.name) ?? "an organization",
|
|
4345
4580
|
kind: "organization",
|
|
4346
4581
|
url: typeof o.pageUrl === "string" ? o.pageUrl : void 0
|
|
@@ -4350,12 +4585,12 @@ function participantOf(p) {
|
|
|
4350
4585
|
return void 0;
|
|
4351
4586
|
}
|
|
4352
4587
|
var isMe = (urn, mailbox2) => typeof urn === "string" && urn.includes(mailbox2);
|
|
4353
|
-
function messageOf(m,
|
|
4588
|
+
function messageOf(m, byUrn2, mailbox2) {
|
|
4354
4589
|
const sender = m["*sender"] ?? m["*actor"];
|
|
4355
4590
|
const fromMe = isMe(sender, mailbox2);
|
|
4356
|
-
const who = fromMe ? void 0 : participantOf(
|
|
4591
|
+
const who = fromMe ? void 0 : participantOf(byUrn2.get(sender));
|
|
4357
4592
|
const render2 = Array.isArray(m.renderContent) ? m.renderContent : [];
|
|
4358
|
-
return
|
|
4593
|
+
return defined6({
|
|
4359
4594
|
from: fromMe ? "you" : who?.name ?? "unknown",
|
|
4360
4595
|
fromMe,
|
|
4361
4596
|
at: iso(m.deliveredAt),
|
|
@@ -4364,7 +4599,7 @@ function messageOf(m, byUrn, mailbox2) {
|
|
|
4364
4599
|
sponsored: render2.some((r) => r.conversationAdsMessageContent) ? true : void 0
|
|
4365
4600
|
});
|
|
4366
4601
|
}
|
|
4367
|
-
var
|
|
4602
|
+
var drift6 = (message) => ({
|
|
4368
4603
|
ok: false,
|
|
4369
4604
|
code: "SCHEMA_DRIFT",
|
|
4370
4605
|
message,
|
|
@@ -4384,26 +4619,26 @@ function refsOf(top) {
|
|
|
4384
4619
|
function parseConversations(json, mailbox2) {
|
|
4385
4620
|
const top = collectionOf(json);
|
|
4386
4621
|
const refs = refsOf(top);
|
|
4387
|
-
if (refs === void 0) return
|
|
4622
|
+
if (refs === void 0) return drift6("the conversation list was missing");
|
|
4388
4623
|
const included = json.included ?? [];
|
|
4389
|
-
const
|
|
4624
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
4390
4625
|
const conversations = [];
|
|
4391
4626
|
for (const ref of refs) {
|
|
4392
|
-
const c =
|
|
4627
|
+
const c = byUrn2.get(ref);
|
|
4393
4628
|
if (c === void 0) continue;
|
|
4394
|
-
const parts = (c["*conversationParticipants"] ?? []).filter((u) => !isMe(u, mailbox2)).map((u) => participantOf(
|
|
4629
|
+
const parts = (c["*conversationParticipants"] ?? []).filter((u) => !isMe(u, mailbox2)).map((u) => participantOf(byUrn2.get(u))).filter((p) => p !== void 0);
|
|
4395
4630
|
const lastRef = c.messages?.["*elements"]?.[0];
|
|
4396
|
-
const last = lastRef === void 0 ? void 0 :
|
|
4631
|
+
const last = lastRef === void 0 ? void 0 : byUrn2.get(lastRef);
|
|
4397
4632
|
const categories = Array.isArray(c.categories) ? c.categories : [];
|
|
4398
4633
|
conversations.push(
|
|
4399
|
-
|
|
4634
|
+
defined6({
|
|
4400
4635
|
id: String(c.entityUrn),
|
|
4401
4636
|
url: typeof c.conversationUrl === "string" ? c.conversationUrl : void 0,
|
|
4402
4637
|
with: parts,
|
|
4403
4638
|
title: c.groupChat === true ? txt2(c.title) : void 0,
|
|
4404
4639
|
unread: typeof c.unreadCount === "number" ? c.unreadCount : 0,
|
|
4405
4640
|
lastActivity: iso(c.lastActivityAt),
|
|
4406
|
-
last: last === void 0 ? void 0 : messageOf(last,
|
|
4641
|
+
last: last === void 0 ? void 0 : messageOf(last, byUrn2, mailbox2),
|
|
4407
4642
|
// PRIMARY_INBOX sits inside INBOX; report the folder a person would name.
|
|
4408
4643
|
folders: categories.map((k) => FOLDER_OF[k]).filter(
|
|
4409
4644
|
(f) => f !== void 0 && !(f === "primary" && categories.includes("INBOX"))
|
|
@@ -4413,7 +4648,7 @@ function parseConversations(json, mailbox2) {
|
|
|
4413
4648
|
);
|
|
4414
4649
|
}
|
|
4415
4650
|
if (refs.length > 0 && conversations.length === 0)
|
|
4416
|
-
return
|
|
4651
|
+
return drift6(`${refs.length} conversations were listed but none were sent`);
|
|
4417
4652
|
const cursor = top?.metadata?.nextCursor;
|
|
4418
4653
|
return {
|
|
4419
4654
|
ok: true,
|
|
@@ -4424,17 +4659,17 @@ function parseConversations(json, mailbox2) {
|
|
|
4424
4659
|
function parseMessages(json, mailbox2) {
|
|
4425
4660
|
const top = collectionOf(json);
|
|
4426
4661
|
const refs = refsOf(top);
|
|
4427
|
-
if (refs === void 0) return
|
|
4662
|
+
if (refs === void 0) return drift6("the message list was missing");
|
|
4428
4663
|
const included = json.included ?? [];
|
|
4429
|
-
const
|
|
4664
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
4430
4665
|
const messages = [];
|
|
4431
4666
|
for (const ref of refs) {
|
|
4432
|
-
const m =
|
|
4667
|
+
const m = byUrn2.get(ref);
|
|
4433
4668
|
if (m === void 0 || typeof m.deliveredAt !== "number") continue;
|
|
4434
|
-
messages.push({ id: String(m.entityUrn), ...messageOf(m,
|
|
4669
|
+
messages.push({ id: String(m.entityUrn), ...messageOf(m, byUrn2, mailbox2) });
|
|
4435
4670
|
}
|
|
4436
4671
|
if (refs.length > 0 && messages.length === 0)
|
|
4437
|
-
return
|
|
4672
|
+
return drift6(`${refs.length} messages were listed but none were sent`);
|
|
4438
4673
|
messages.sort((a, b) => a.at.localeCompare(b.at));
|
|
4439
4674
|
return { ok: true, messages };
|
|
4440
4675
|
}
|
|
@@ -4589,8 +4824,8 @@ function loadDrafts() {
|
|
|
4589
4824
|
};
|
|
4590
4825
|
return Array.isArray(loaded.value) ? loaded.value : [];
|
|
4591
4826
|
}
|
|
4592
|
-
async function runDraft(conversation,
|
|
4593
|
-
const body =
|
|
4827
|
+
async function runDraft(conversation, text7, fetch2, opts = {}) {
|
|
4828
|
+
const body = text7?.trim() ?? "";
|
|
4594
4829
|
if (body === "")
|
|
4595
4830
|
return err(
|
|
4596
4831
|
"draft",
|
|
@@ -4690,14 +4925,14 @@ function itemsUrl(list, q) {
|
|
|
4690
4925
|
});
|
|
4691
4926
|
return `${c.path}?variables=${variables}&queryId=${c.queryId}`;
|
|
4692
4927
|
}
|
|
4693
|
-
var
|
|
4928
|
+
var text5 = (v) => {
|
|
4694
4929
|
const t = v?.text;
|
|
4695
4930
|
return typeof t === "string" && t.trim() !== "" ? t.trim().replace(/\s+/g, " ") : void 0;
|
|
4696
4931
|
};
|
|
4697
4932
|
var inner = (urn) => String(urn ?? "").match(/\((urn:li:[A-Za-z_]+:[^,)]+)/)?.[1];
|
|
4698
4933
|
var clean = (url) => typeof url === "string" && url.startsWith("https://") ? url.split("?")[0] : void 0;
|
|
4699
|
-
var insight = (row) => (Array.isArray(row.insightsResolutionResults) ? row.insightsResolutionResults : []).map((i) =>
|
|
4700
|
-
function
|
|
4934
|
+
var insight = (row) => (Array.isArray(row.insightsResolutionResults) ? row.insightsResolutionResults : []).map((i) => text5(i.simpleInsight?.title)).find((t) => t !== void 0);
|
|
4935
|
+
function defined7(obj) {
|
|
4701
4936
|
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
4702
4937
|
return obj;
|
|
4703
4938
|
}
|
|
@@ -4709,40 +4944,40 @@ var WORKPLACE = {
|
|
|
4709
4944
|
function postRow(row) {
|
|
4710
4945
|
const id = inner(row.entityUrn);
|
|
4711
4946
|
if (id === void 0 || !/^urn:li:(activity|ugcPost|share):/.test(id)) return void 0;
|
|
4712
|
-
const posted =
|
|
4713
|
-
return
|
|
4947
|
+
const posted = text5(row.secondarySubtitle)?.replace(/\s*•\s*$/, "");
|
|
4948
|
+
return defined7({
|
|
4714
4949
|
id,
|
|
4715
4950
|
url: `https://www.linkedin.com/feed/update/${id}/`,
|
|
4716
|
-
author:
|
|
4717
|
-
authorHeadline:
|
|
4951
|
+
author: text5(row.title),
|
|
4952
|
+
authorHeadline: text5(row.primarySubtitle),
|
|
4718
4953
|
posted,
|
|
4719
|
-
text:
|
|
4954
|
+
text: text5(row.summary)
|
|
4720
4955
|
});
|
|
4721
4956
|
}
|
|
4722
4957
|
function courseRow(row) {
|
|
4723
4958
|
const id = inner(row.entityUrn)?.split(":").pop();
|
|
4724
|
-
const name =
|
|
4959
|
+
const name = text5(row.title);
|
|
4725
4960
|
if (id === void 0 || name === void 0) return void 0;
|
|
4726
|
-
return
|
|
4961
|
+
return defined7({
|
|
4727
4962
|
id,
|
|
4728
4963
|
name,
|
|
4729
|
-
length:
|
|
4730
|
-
detail:
|
|
4731
|
-
progress:
|
|
4964
|
+
length: text5(row.primarySubtitle),
|
|
4965
|
+
detail: text5(row.secondarySubtitle),
|
|
4966
|
+
progress: text5(row.summary),
|
|
4732
4967
|
url: clean(row.navigationUrl)
|
|
4733
4968
|
});
|
|
4734
4969
|
}
|
|
4735
4970
|
function jobRow(row, stage) {
|
|
4736
4971
|
const id = inner(row.entityUrn)?.split(":").pop();
|
|
4737
|
-
const title =
|
|
4972
|
+
const title = text5(row.title);
|
|
4738
4973
|
if (id === void 0 || title === void 0) return void 0;
|
|
4739
|
-
const place =
|
|
4974
|
+
const place = text5(row.secondarySubtitle);
|
|
4740
4975
|
const m = place?.match(/^(.*?)\s*\(([^()]+)\)$/);
|
|
4741
4976
|
const workplace = m?.[2] === void 0 ? void 0 : WORKPLACE[m[2].toLowerCase()];
|
|
4742
|
-
return
|
|
4977
|
+
return defined7({
|
|
4743
4978
|
id,
|
|
4744
4979
|
title,
|
|
4745
|
-
company:
|
|
4980
|
+
company: text5(row.primarySubtitle),
|
|
4746
4981
|
location: workplace !== void 0 ? m?.[1] : place,
|
|
4747
4982
|
workplace,
|
|
4748
4983
|
stage,
|
|
@@ -4902,7 +5137,7 @@ function searchUrl(q) {
|
|
|
4902
5137
|
kind: SEARCH_KINDS[q.kind]
|
|
4903
5138
|
});
|
|
4904
5139
|
}
|
|
4905
|
-
var
|
|
5140
|
+
var text6 = (v) => {
|
|
4906
5141
|
const t = v?.text;
|
|
4907
5142
|
return typeof t === "string" && t.trim() !== "" ? t.trim().replace(/\s+/g, " ") : void 0;
|
|
4908
5143
|
};
|
|
@@ -4916,13 +5151,13 @@ function cleanUrl2(nav) {
|
|
|
4916
5151
|
}
|
|
4917
5152
|
function rowToFound(row) {
|
|
4918
5153
|
const id = idOf2(row.entityUrn);
|
|
4919
|
-
const name =
|
|
5154
|
+
const name = text6(row.title);
|
|
4920
5155
|
if (id === void 0 || name === void 0) return void 0;
|
|
4921
5156
|
const found = { id, name };
|
|
4922
5157
|
const fields = [
|
|
4923
|
-
["subtitle",
|
|
4924
|
-
["detail",
|
|
4925
|
-
["summary",
|
|
5158
|
+
["subtitle", text6(row.primarySubtitle)],
|
|
5159
|
+
["detail", text6(row.secondarySubtitle)],
|
|
5160
|
+
["summary", text6(row.summary)],
|
|
4926
5161
|
["url", cleanUrl2(row.navigationUrl)]
|
|
4927
5162
|
];
|
|
4928
5163
|
for (const [k, v] of fields)
|
|
@@ -4930,7 +5165,7 @@ function rowToFound(row) {
|
|
|
4930
5165
|
if (JSON.stringify(row.badgeIcon ?? null).includes("VERIFIED")) found.verified = true;
|
|
4931
5166
|
return found;
|
|
4932
5167
|
}
|
|
4933
|
-
var
|
|
5168
|
+
var drift7 = (message) => ({
|
|
4934
5169
|
ok: false,
|
|
4935
5170
|
code: "SCHEMA_DRIFT",
|
|
4936
5171
|
message,
|
|
@@ -4939,7 +5174,7 @@ var drift6 = (message) => ({
|
|
|
4939
5174
|
function parseResults(json) {
|
|
4940
5175
|
const c = clustersOf(json);
|
|
4941
5176
|
if (c === void 0 || !Array.isArray(c.elements))
|
|
4942
|
-
return
|
|
5177
|
+
return drift7("the search returned no result list");
|
|
4943
5178
|
const included = json.included ?? [];
|
|
4944
5179
|
const { people: items, unknownTypes, excluded, unresolved } = readItems(c, included, rowToFound);
|
|
4945
5180
|
const total = typeof c.paging?.total === "number" ? c.paging.total : void 0;
|
|
@@ -4947,7 +5182,7 @@ function parseResults(json) {
|
|
|
4947
5182
|
const claimedRaw = c.metadata?.totalResultCount;
|
|
4948
5183
|
const claimed = typeof claimedRaw === "number" ? claimedRaw : total;
|
|
4949
5184
|
if (unresolved > 0 && items.length === 0)
|
|
4950
|
-
return
|
|
5185
|
+
return drift7(`${unresolved} results were listed but none could be read`);
|
|
4951
5186
|
if (items.length === 0 && total !== void 0 && total > start) {
|
|
4952
5187
|
return {
|
|
4953
5188
|
ok: false,
|
|
@@ -5018,15 +5253,15 @@ function parseSentInvitations(json) {
|
|
|
5018
5253
|
if (!Array.isArray(refs))
|
|
5019
5254
|
return { ok: false, code: "SCHEMA_DRIFT", message: "the sent invitations list was missing" };
|
|
5020
5255
|
const included = json.included ?? [];
|
|
5021
|
-
const
|
|
5256
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
5022
5257
|
const invitations2 = [];
|
|
5023
5258
|
for (const ref of refs) {
|
|
5024
|
-
const view =
|
|
5025
|
-
const inv =
|
|
5259
|
+
const view = byUrn2.get(ref);
|
|
5260
|
+
const inv = byUrn2.get(view?.["*invitation"]) ?? included.find(
|
|
5026
5261
|
(n) => String(n.$type).endsWith(".Invitation") && typeof ref === "string" && ref.endsWith(String(n.entityUrn))
|
|
5027
5262
|
);
|
|
5028
5263
|
if (inv === void 0) continue;
|
|
5029
|
-
const who =
|
|
5264
|
+
const who = byUrn2.get(inv["*toMember"]);
|
|
5030
5265
|
const name = [who?.firstName, who?.lastName].filter((x) => typeof x === "string" && x !== "").join(" ");
|
|
5031
5266
|
const id = String(inv["*toMember"] ?? "").split(":").pop();
|
|
5032
5267
|
const note = typeof inv.message === "string" ? inv.message : inv.message?.text;
|
|
@@ -5167,15 +5402,15 @@ function notificationsUrl(count3, start) {
|
|
|
5167
5402
|
if (c?.decorationId === void 0) throw new Error("the 'notifications' contract is missing");
|
|
5168
5403
|
return `${c.path}?decorationId=${c.decorationId}&q=filterVanityName&count=${count3}&start=${start}`;
|
|
5169
5404
|
}
|
|
5170
|
-
var
|
|
5405
|
+
var drift8 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
5171
5406
|
var textOf = (v) => {
|
|
5172
5407
|
const t = v?.text;
|
|
5173
5408
|
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
5174
5409
|
};
|
|
5175
5410
|
var absolute = (v) => typeof v === "string" && v !== "" ? v.startsWith("/") ? `https://www.linkedin.com${v}` : v : void 0;
|
|
5176
5411
|
function card(n) {
|
|
5177
|
-
const
|
|
5178
|
-
if (
|
|
5412
|
+
const text7 = textOf(n.headline);
|
|
5413
|
+
if (text7 === void 0) return void 0;
|
|
5179
5414
|
const kind = String(n.entityUrn ?? "").match(/fsd_notificationCard:\(([^,]+),/)?.[1] ?? "UNKNOWN";
|
|
5180
5415
|
const detail = [n.subHeadline, n.contentPrimaryText, n.contentSecondaryText, n.kickerText].map(textOf).filter((t) => t !== void 0).join(" \xB7 ");
|
|
5181
5416
|
const at = typeof n.publishedAt === "number" ? new Date(n.publishedAt).toISOString() : void 0;
|
|
@@ -5183,7 +5418,7 @@ function card(n) {
|
|
|
5183
5418
|
const from = absolute(n.headerImage?.actionTarget);
|
|
5184
5419
|
return {
|
|
5185
5420
|
kind,
|
|
5186
|
-
text:
|
|
5421
|
+
text: text7,
|
|
5187
5422
|
...detail !== "" ? { detail } : {},
|
|
5188
5423
|
...at !== void 0 ? { at } : {},
|
|
5189
5424
|
read: n.read === true,
|
|
@@ -5195,15 +5430,15 @@ function parseNotifications(json) {
|
|
|
5195
5430
|
const root = json;
|
|
5196
5431
|
const data = root?.data;
|
|
5197
5432
|
const listed = data?.["*elements"] ?? data?.elements;
|
|
5198
|
-
if (!Array.isArray(listed)) return
|
|
5199
|
-
const
|
|
5433
|
+
if (!Array.isArray(listed)) return drift8("the notifications answer carried no card list");
|
|
5434
|
+
const byUrn2 = new Map((root?.included ?? []).map((n) => [n.entityUrn, n]));
|
|
5200
5435
|
const items = listed.flatMap((u) => {
|
|
5201
|
-
const n =
|
|
5436
|
+
const n = byUrn2.get(u);
|
|
5202
5437
|
const c = n === void 0 ? void 0 : card(n);
|
|
5203
5438
|
return c === void 0 ? [] : [c];
|
|
5204
5439
|
});
|
|
5205
5440
|
if (listed.length > 0 && items.length === 0)
|
|
5206
|
-
return
|
|
5441
|
+
return drift8(`${listed.length} notifications were listed but none could be read`);
|
|
5207
5442
|
const meta = data?.metadata ?? {};
|
|
5208
5443
|
return {
|
|
5209
5444
|
ok: true,
|
|
@@ -5283,7 +5518,7 @@ function contactInfoBody(publicId, firstName, lastName) {
|
|
|
5283
5518
|
isModal: true
|
|
5284
5519
|
};
|
|
5285
5520
|
}
|
|
5286
|
-
var
|
|
5521
|
+
var drift9 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
5287
5522
|
var unquote2 = (s) => JSON.parse(`"${s}"`);
|
|
5288
5523
|
var LABEL = /\["\$","p",null,\{"className":"[^"]*","children":\["((?:[^"\\]|\\.)+)"\]\}\]/g;
|
|
5289
5524
|
var VIEW = /"viewName":"contact-([a-z-]+)"/g;
|
|
@@ -5321,13 +5556,13 @@ function fieldsOf(stream) {
|
|
|
5321
5556
|
}
|
|
5322
5557
|
var camel = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
5323
5558
|
function put(contact, f) {
|
|
5324
|
-
const
|
|
5559
|
+
const text7 = f.texts.join(", ");
|
|
5325
5560
|
switch (f.view) {
|
|
5326
5561
|
case "your-profile":
|
|
5327
5562
|
return;
|
|
5328
5563
|
// `profile` already has the profile URL.
|
|
5329
5564
|
case "email":
|
|
5330
|
-
contact.email = f.links[0] ??
|
|
5565
|
+
contact.email = f.links[0] ?? text7;
|
|
5331
5566
|
return;
|
|
5332
5567
|
case "website":
|
|
5333
5568
|
contact.websites = [
|
|
@@ -5345,18 +5580,18 @@ function put(contact, f) {
|
|
|
5345
5580
|
contact.twitter = [...contact.twitter ?? [], ...f.texts];
|
|
5346
5581
|
return;
|
|
5347
5582
|
case void 0:
|
|
5348
|
-
if (/^connected since$/i.test(f.label)) contact.connectedSince =
|
|
5349
|
-
else contact.other = { ...contact.other, [f.label]:
|
|
5583
|
+
if (/^connected since$/i.test(f.label)) contact.connectedSince = text7;
|
|
5584
|
+
else contact.other = { ...contact.other, [f.label]: text7 };
|
|
5350
5585
|
return;
|
|
5351
5586
|
default:
|
|
5352
|
-
contact[camel(f.view)] =
|
|
5587
|
+
contact[camel(f.view)] = text7;
|
|
5353
5588
|
}
|
|
5354
5589
|
}
|
|
5355
5590
|
function parseContactInfo(stream) {
|
|
5356
5591
|
if (!stream.includes("profile-contact-info-details-view"))
|
|
5357
|
-
return
|
|
5592
|
+
return drift9("the contact info answer was not the contact info overlay");
|
|
5358
5593
|
const fields = fieldsOf(stream);
|
|
5359
|
-
if (fields.length === 0) return
|
|
5594
|
+
if (fields.length === 0) return drift9("the contact info overlay had no fields");
|
|
5360
5595
|
const contact = {};
|
|
5361
5596
|
for (const f of fields) put(contact, f);
|
|
5362
5597
|
return { ok: true, contact };
|
|
@@ -5377,10 +5612,10 @@ function positionsPageUrl(profileUrn, start) {
|
|
|
5377
5612
|
const c = contract3("profilePositions");
|
|
5378
5613
|
return `${c.path}?q=viewee&profileUrn=${encodeURIComponent(profileUrn)}&decorationId=${c.decorationId}&start=${start}&count=${POSITIONS_PAGE}`;
|
|
5379
5614
|
}
|
|
5380
|
-
var
|
|
5381
|
-
var
|
|
5615
|
+
var drift10 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
5616
|
+
var str4 = (v) => typeof v === "string" && v.trim() !== "" && v.trim() !== "-" ? v.trim() : void 0;
|
|
5382
5617
|
var idOf3 = (urn) => String(urn ?? "").match(/:(\d+)$/)?.[1];
|
|
5383
|
-
function
|
|
5618
|
+
function defined8(obj) {
|
|
5384
5619
|
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
5385
5620
|
return obj;
|
|
5386
5621
|
}
|
|
@@ -5395,7 +5630,7 @@ function range(v) {
|
|
|
5395
5630
|
const r = v;
|
|
5396
5631
|
const start = date(r?.start);
|
|
5397
5632
|
const end = date(r?.end);
|
|
5398
|
-
return
|
|
5633
|
+
return defined8({
|
|
5399
5634
|
start,
|
|
5400
5635
|
end,
|
|
5401
5636
|
current: start !== void 0 && end === void 0 ? true : void 0
|
|
@@ -5418,21 +5653,21 @@ var Index = class {
|
|
|
5418
5653
|
collection(urn) {
|
|
5419
5654
|
const c = this.get(urn);
|
|
5420
5655
|
const refs = Array.isArray(c?.["*elements"]) ? c?.["*elements"] : [];
|
|
5421
|
-
const
|
|
5656
|
+
const nodes2 = refs.flatMap((r) => this.list(r));
|
|
5422
5657
|
const total = c?.paging?.total;
|
|
5423
|
-
return typeof total === "number" ? { nodes, total } : { nodes };
|
|
5658
|
+
return typeof total === "number" ? { nodes: nodes2, total } : { nodes: nodes2 };
|
|
5424
5659
|
}
|
|
5425
5660
|
};
|
|
5426
5661
|
function role(p, group, ix) {
|
|
5427
5662
|
const companyUrn = p.companyUrn ?? group?.companyUrn;
|
|
5428
|
-
return
|
|
5429
|
-
title:
|
|
5430
|
-
company:
|
|
5663
|
+
return defined8({
|
|
5664
|
+
title: str4(p.title),
|
|
5665
|
+
company: str4(p.companyName) ?? str4(group?.companyName),
|
|
5431
5666
|
companyId: idOf3(companyUrn),
|
|
5432
|
-
employmentType:
|
|
5433
|
-
location:
|
|
5667
|
+
employmentType: str4(ix.get(p["*employmentType"])?.name),
|
|
5668
|
+
location: str4(p.locationName) ?? str4(p.geoLocationName),
|
|
5434
5669
|
...range(p.dateRange),
|
|
5435
|
-
description:
|
|
5670
|
+
description: str4(p.description)
|
|
5436
5671
|
});
|
|
5437
5672
|
}
|
|
5438
5673
|
function rolesOf(groups, ix) {
|
|
@@ -5442,39 +5677,39 @@ function rolesOf(groups, ix) {
|
|
|
5442
5677
|
});
|
|
5443
5678
|
}
|
|
5444
5679
|
function school(e) {
|
|
5445
|
-
return
|
|
5446
|
-
school:
|
|
5680
|
+
return defined8({
|
|
5681
|
+
school: str4(e.schoolName),
|
|
5447
5682
|
schoolId: idOf3(e.schoolUrn),
|
|
5448
|
-
degree:
|
|
5449
|
-
field:
|
|
5683
|
+
degree: str4(e.degreeName),
|
|
5684
|
+
field: str4(e.fieldOfStudy),
|
|
5450
5685
|
...range(e.dateRange),
|
|
5451
|
-
grade:
|
|
5452
|
-
activities:
|
|
5453
|
-
description:
|
|
5686
|
+
grade: str4(e.grade),
|
|
5687
|
+
activities: str4(e.activities),
|
|
5688
|
+
description: str4(e.description)
|
|
5454
5689
|
});
|
|
5455
5690
|
}
|
|
5456
5691
|
function entry(n) {
|
|
5457
|
-
const proficiency =
|
|
5458
|
-
return
|
|
5459
|
-
name:
|
|
5460
|
-
title:
|
|
5461
|
-
role:
|
|
5462
|
-
organization:
|
|
5463
|
-
authority:
|
|
5464
|
-
issuer:
|
|
5465
|
-
publisher:
|
|
5692
|
+
const proficiency = str4(n.proficiency);
|
|
5693
|
+
return defined8({
|
|
5694
|
+
name: str4(n.name),
|
|
5695
|
+
title: str4(n.title),
|
|
5696
|
+
role: str4(n.role),
|
|
5697
|
+
organization: str4(n.companyName),
|
|
5698
|
+
authority: str4(n.authority),
|
|
5699
|
+
issuer: str4(n.issuer),
|
|
5700
|
+
publisher: str4(n.publisher),
|
|
5466
5701
|
proficiency: proficiency?.toLowerCase().replace(/_/g, " "),
|
|
5467
|
-
number:
|
|
5468
|
-
score:
|
|
5469
|
-
cause:
|
|
5702
|
+
number: str4(n.number) ?? str4(n.licenseNumber) ?? str4(n.patentNumber),
|
|
5703
|
+
score: str4(n.score),
|
|
5704
|
+
cause: str4(n.cause)?.toLowerCase().replace(/_/g, " "),
|
|
5470
5705
|
...range(n.dateRange),
|
|
5471
5706
|
issued: date(n.issuedOn),
|
|
5472
5707
|
published: date(n.publishedOn),
|
|
5473
|
-
url:
|
|
5474
|
-
description:
|
|
5708
|
+
url: str4(n.url),
|
|
5709
|
+
description: str4(n.description)
|
|
5475
5710
|
});
|
|
5476
5711
|
}
|
|
5477
|
-
var
|
|
5712
|
+
var SECTIONS2 = {
|
|
5478
5713
|
certifications: "*profileCertifications",
|
|
5479
5714
|
languages: "*profileLanguages",
|
|
5480
5715
|
honors: "*profileHonors",
|
|
@@ -5490,13 +5725,13 @@ var some = (xs) => xs.length > 0 ? xs : void 0;
|
|
|
5490
5725
|
function parseFullProfile(json) {
|
|
5491
5726
|
const root = json;
|
|
5492
5727
|
const listed = root?.data?.["*elements"];
|
|
5493
|
-
if (!Array.isArray(listed)) return
|
|
5728
|
+
if (!Array.isArray(listed)) return drift10("the profile answer carried no profile list");
|
|
5494
5729
|
if (listed.length === 0)
|
|
5495
5730
|
return { ok: false, code: "NOT_FOUND", message: "no profile has that id on LinkedIn" };
|
|
5496
5731
|
const ix = new Index(root?.included ?? []);
|
|
5497
5732
|
const p = ix.get(listed[0]);
|
|
5498
5733
|
const urn = typeof p?.entityUrn === "string" ? p.entityUrn : void 0;
|
|
5499
|
-
if (p === void 0 || urn === void 0) return
|
|
5734
|
+
if (p === void 0 || urn === void 0) return drift10("the profile was listed but not sent");
|
|
5500
5735
|
const counts2 = {};
|
|
5501
5736
|
const count3 = (key, shown, total) => {
|
|
5502
5737
|
if (total !== void 0 && total > shown) counts2[key] = { shown, total };
|
|
@@ -5508,32 +5743,32 @@ function parseFullProfile(json) {
|
|
|
5508
5743
|
const education = schools.nodes.map(school);
|
|
5509
5744
|
const skillNodes = ix.collection(p["*profileSkills"]);
|
|
5510
5745
|
count3("skills", skillNodes.nodes.length, skillNodes.total);
|
|
5511
|
-
const skills = skillNodes.nodes.flatMap((s) =>
|
|
5746
|
+
const skills = skillNodes.nodes.flatMap((s) => str4(s.name) ?? []);
|
|
5512
5747
|
const sections = {};
|
|
5513
|
-
for (const [key, field] of Object.entries(
|
|
5748
|
+
for (const [key, field] of Object.entries(SECTIONS2)) {
|
|
5514
5749
|
const c = ix.collection(p[field]);
|
|
5515
5750
|
count3(key, c.nodes.length, c.total);
|
|
5516
5751
|
const rows = c.nodes.map(entry);
|
|
5517
5752
|
if (rows.length > 0) sections[key] = rows;
|
|
5518
5753
|
}
|
|
5519
|
-
const publicId =
|
|
5520
|
-
const name = [
|
|
5754
|
+
const publicId = str4(p.publicIdentifier);
|
|
5755
|
+
const name = [str4(p.firstName), str4(p.lastName)].filter(Boolean).join(" ");
|
|
5521
5756
|
const geo = ix.get(p.geoLocation?.["*geo"]);
|
|
5522
5757
|
const bool2 = (v) => v === true ? true : void 0;
|
|
5523
5758
|
return {
|
|
5524
5759
|
ok: true,
|
|
5525
|
-
profile:
|
|
5760
|
+
profile: defined8({
|
|
5526
5761
|
id: urn.split(":").pop(),
|
|
5527
5762
|
urn,
|
|
5528
5763
|
publicId,
|
|
5529
5764
|
name: name === "" ? void 0 : name,
|
|
5530
|
-
firstName:
|
|
5531
|
-
lastName:
|
|
5532
|
-
headline:
|
|
5765
|
+
firstName: str4(p.firstName),
|
|
5766
|
+
lastName: str4(p.lastName),
|
|
5767
|
+
headline: str4(p.headline),
|
|
5533
5768
|
url: publicId === void 0 ? void 0 : `https://www.linkedin.com/in/${publicId}/`,
|
|
5534
|
-
location:
|
|
5535
|
-
industry:
|
|
5536
|
-
about:
|
|
5769
|
+
location: str4(geo?.defaultLocalizedName),
|
|
5770
|
+
industry: str4(ix.get(p["*industry"])?.name),
|
|
5771
|
+
about: str4(p.summary),
|
|
5537
5772
|
title: experience[0]?.title,
|
|
5538
5773
|
company: experience[0]?.company,
|
|
5539
5774
|
school: education[0]?.school,
|
|
@@ -5551,11 +5786,11 @@ function parseFullProfile(json) {
|
|
|
5551
5786
|
function parsePositionsPage(json) {
|
|
5552
5787
|
const root = json;
|
|
5553
5788
|
const refs = root?.data?.["*elements"];
|
|
5554
|
-
if (!Array.isArray(refs)) return
|
|
5789
|
+
if (!Array.isArray(refs)) return drift10("the experience page carried no position groups");
|
|
5555
5790
|
const ix = new Index(root?.included ?? []);
|
|
5556
5791
|
const groups = refs.flatMap((r) => ix.list(r));
|
|
5557
5792
|
if (refs.length > 0 && groups.length === 0)
|
|
5558
|
-
return
|
|
5793
|
+
return drift10(`${refs.length} position groups were listed but none sent`);
|
|
5559
5794
|
const total = root?.data?.paging?.total;
|
|
5560
5795
|
return {
|
|
5561
5796
|
ok: true,
|
|
@@ -5595,7 +5830,7 @@ function recommendationsBody(kind, vanityName, profileId2, start) {
|
|
|
5595
5830
|
}
|
|
5596
5831
|
};
|
|
5597
5832
|
}
|
|
5598
|
-
var
|
|
5833
|
+
var drift11 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
5599
5834
|
var unquote3 = (s) => JSON.parse(`"${s}"`);
|
|
5600
5835
|
var STR = '((?:[^"\\\\]|\\\\.)+)';
|
|
5601
5836
|
var loading = (id) => new RegExp(
|
|
@@ -5643,7 +5878,7 @@ function bodyOf(segment) {
|
|
|
5643
5878
|
}
|
|
5644
5879
|
function parseRecommendations(stream) {
|
|
5645
5880
|
if (!stream.includes("isPartialPage") && !stream.includes(PAGER))
|
|
5646
|
-
return
|
|
5881
|
+
return drift11("the recommendations answer was not the recommendations list");
|
|
5647
5882
|
const rows = new Rows(stream);
|
|
5648
5883
|
const headers = [...rows.byId].filter(([, row]) => NAME.test(row) && !row.startsWith('[["$"')).map(([id]) => id);
|
|
5649
5884
|
const heads = new Set(headers);
|
|
@@ -5667,11 +5902,11 @@ function parseRecommendations(stream) {
|
|
|
5667
5902
|
}
|
|
5668
5903
|
}
|
|
5669
5904
|
const who = header(rows, p.h);
|
|
5670
|
-
const
|
|
5671
|
-
if (who !== void 0 &&
|
|
5905
|
+
const text7 = bodyOf(inlined(rows, row.slice(p.at, end)));
|
|
5906
|
+
if (who !== void 0 && text7 !== "") items.push({ ...who, text: text7 });
|
|
5672
5907
|
}
|
|
5673
5908
|
if (headers.length > 0 && items.length === 0)
|
|
5674
|
-
return
|
|
5909
|
+
return drift11(`${headers.length} recommendations were shown but none could be read`);
|
|
5675
5910
|
return { ok: true, items };
|
|
5676
5911
|
}
|
|
5677
5912
|
|
|
@@ -5695,7 +5930,7 @@ var PROFILE_FIELDS = {
|
|
|
5695
5930
|
maxLength: 2600
|
|
5696
5931
|
}
|
|
5697
5932
|
};
|
|
5698
|
-
var
|
|
5933
|
+
var drift12 = (message) => ({
|
|
5699
5934
|
ok: false,
|
|
5700
5935
|
code: "SCHEMA_DRIFT",
|
|
5701
5936
|
message,
|
|
@@ -5750,7 +5985,7 @@ var EDIT_NAV = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"
|
|
|
5750
5985
|
var TEXT4 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
|
|
5751
5986
|
function skillsFromPage(stream) {
|
|
5752
5987
|
if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV) && !stream.includes("isPartialPage")) {
|
|
5753
|
-
return
|
|
5988
|
+
return drift12("the skills page could not be read");
|
|
5754
5989
|
}
|
|
5755
5990
|
const skills = [];
|
|
5756
5991
|
let from = 0;
|
|
@@ -5758,11 +5993,11 @@ function skillsFromPage(stream) {
|
|
|
5758
5993
|
for (; ; ) {
|
|
5759
5994
|
i = stream.indexOf(EDIT_NAV, i);
|
|
5760
5995
|
if (i === -1) break;
|
|
5761
|
-
const
|
|
5996
|
+
const text7 = balanced(stream, i);
|
|
5762
5997
|
const end = i;
|
|
5763
5998
|
i += EDIT_NAV.length;
|
|
5764
|
-
if (
|
|
5765
|
-
const payload = JSON.parse(
|
|
5999
|
+
if (text7 === null) continue;
|
|
6000
|
+
const payload = JSON.parse(text7).requestedArguments?.payload;
|
|
5766
6001
|
const id = payload?.skillId;
|
|
5767
6002
|
if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
|
|
5768
6003
|
continue;
|
|
@@ -5770,7 +6005,7 @@ function skillsFromPage(stream) {
|
|
|
5770
6005
|
(m) => JSON.parse(`"${m[1]}"`)
|
|
5771
6006
|
);
|
|
5772
6007
|
skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
|
|
5773
|
-
from = end +
|
|
6008
|
+
from = end + text7.length;
|
|
5774
6009
|
}
|
|
5775
6010
|
return { ok: true, skills };
|
|
5776
6011
|
}
|
|
@@ -5789,8 +6024,8 @@ function skillRowsOf(stream) {
|
|
|
5789
6024
|
function listPayloadOf(screen) {
|
|
5790
6025
|
const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
|
|
5791
6026
|
const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
|
|
5792
|
-
const
|
|
5793
|
-
return
|
|
6027
|
+
const text7 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
|
|
6028
|
+
return text7 === null ? null : JSON.parse(text7);
|
|
5794
6029
|
}
|
|
5795
6030
|
function pagerFrom(payload, start) {
|
|
5796
6031
|
const args = {
|
|
@@ -5812,11 +6047,11 @@ function pagerFrom(payload, start) {
|
|
|
5812
6047
|
}
|
|
5813
6048
|
function readSkillForm(stream) {
|
|
5814
6049
|
const model = readModel(stream);
|
|
5815
|
-
if (model === null) return
|
|
6050
|
+
if (model === null) return drift12("the skill form carried no initial values");
|
|
5816
6051
|
const save = findRequest(stream, SKILL.save);
|
|
5817
6052
|
const del = findRequest(stream, SKILL.delete);
|
|
5818
6053
|
if (save === null && del === null)
|
|
5819
|
-
return
|
|
6054
|
+
return drift12("the skill form carried neither a save nor a delete");
|
|
5820
6055
|
return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
|
|
5821
6056
|
}
|
|
5822
6057
|
var PAGER_URL2 = `https://www.linkedin.com/flagship-web/rsc-action/actions/pagination?sduiid=${SKILL.pager}`;
|
|
@@ -5830,7 +6065,7 @@ async function fetchSkills(vanityName, client) {
|
|
|
5830
6065
|
);
|
|
5831
6066
|
if (typeof screen !== "string") return screen;
|
|
5832
6067
|
const payload = listPayloadOf(screen);
|
|
5833
|
-
if (payload === null) return
|
|
6068
|
+
if (payload === null) return drift12("the Skills screen carried no list request");
|
|
5834
6069
|
const count3 = typeof payload.count === "number" ? payload.count : 10;
|
|
5835
6070
|
const skills = [];
|
|
5836
6071
|
for (let page = 0; page < MAX_PAGES2; page++) {
|
|
@@ -6160,16 +6395,16 @@ var COMMANDS = [
|
|
|
6160
6395
|
name: "jobs",
|
|
6161
6396
|
cost: "1 job-search call per 100 jobs; --details adds 1 job read per 100 jobs",
|
|
6162
6397
|
summary: "Job search with every filter the jobs page has. Cards carry id, title, company, place, workplace, listed date, Easy Apply. Read finalists with `job`.",
|
|
6163
|
-
usage: 'lnrelay jobs "<keywords>" ["<more keywords>" ...] [--location "<place>" | --geo <id>]\n [--distance <miles>]\n [--posted 24h|week|month|<N>h|<N>d] [--experience internship,entry,associate,\n mid-senior,director,executive] [--type full-time,part-time,contract,temporary,\n volunteer,internship,other] [--workplace on-site,remote,hybrid] [--easy-apply]\n [--under-10] [--verified] [--in-network] [--fair-chance] [--company <ids>]\n [--industry <ids>] [--function <codes>] [--title <ids>] [--place <geo-ids>]\n [--filter key=v1,v2 ...] [--sort recent|relevant] [--limit N] [--start N]\n [--details [--description]] [--compact | --fields a,b,c]\n Ids for --company/--industry/--title/--place/--filter come from `job-filters`.\n The resolved place is in data.location: check it, "Vienna" may resolve narrow.',
|
|
6398
|
+
usage: 'lnrelay jobs "<keywords>" ["<more keywords>" ...] [--location "<place>" | --geo <id>]\n [--distance <miles>]\n [--posted 24h|week|month|<N>h|<N>d] [--experience internship,entry,associate,\n mid-senior,director,executive] [--type full-time,part-time,contract,temporary,\n volunteer,internship,other] [--workplace on-site,remote,hybrid] [--easy-apply]\n [--under-10] [--verified] [--in-network] [--fair-chance] [--company <ids>]\n [--industry <ids>] [--function <codes>] [--title <ids>] [--place <geo-ids>]\n [--filter key=v1,v2 ...] [--sort recent|relevant] [--limit N] [--start N]\n [--details [--description]] [--compact | --fields a,b,c]\n Ids for --company/--industry/--title/--place/--filter come from `job-filters`.\n The resolved place is in data.location: check it, "Vienna" may resolve narrow.\nlnrelay jobs --top-applicant [--limit N] [--details] [--compact | --fields a,b,c]\n Premium: the jobs where LinkedIn says you would be a top applicant, 100 a call.',
|
|
6164
6399
|
audience: ["cli", "mcp"],
|
|
6165
6400
|
risk: "read",
|
|
6166
6401
|
implemented: true
|
|
6167
6402
|
},
|
|
6168
6403
|
{
|
|
6169
6404
|
name: "job",
|
|
6170
|
-
cost: "1 job read per 100 jobs; --team adds 1 page call per job",
|
|
6171
|
-
summary: "Jobs in full: description, apply link (external or Easy Apply), applicants, state. Several ids are read together, 100 a call. --team adds who posted it and who is hiring.",
|
|
6172
|
-
usage: "lnrelay job <id|job-url> [<id|job-url> ...] [--team] [--compact | --fields a,b,c]",
|
|
6405
|
+
cost: "1 job read per 100 jobs; --team adds 1 page call per job; --insights 1 job read per job",
|
|
6406
|
+
summary: "Jobs in full: description, apply link (external or Easy Apply), applicants, state. Several ids are read together, 100 a call. --team adds who posted it and who is hiring. --insights (Premium) adds who applied (count, last day, seniority, education) and the company's insights: headcount over two years, the job's function, tenure, competitors.",
|
|
6407
|
+
usage: "lnrelay job <id|job-url> [<id|job-url> ...] [--team] [--insights] [--compact | --fields a,b,c]",
|
|
6173
6408
|
audience: ["cli", "mcp"],
|
|
6174
6409
|
risk: "read",
|
|
6175
6410
|
implemented: true
|
|
@@ -6286,8 +6521,8 @@ var COMMANDS = [
|
|
|
6286
6521
|
{
|
|
6287
6522
|
name: "viewers",
|
|
6288
6523
|
cost: "2 page calls",
|
|
6289
|
-
summary: "Who viewed your profile, as your profile-views page shows it: the total for the period, the viewers LinkedIn names (up to 3 on a free account), anonymous ones as LinkedIn describes them, and how many looked in private mode.",
|
|
6290
|
-
usage: "lnrelay viewers [--compact | --fields a,b,c]",
|
|
6524
|
+
summary: "Who viewed your profile, as your profile-views page shows it: the total for the period, the viewers LinkedIn names (up to 3 on a free account, all with Premium), anonymous ones as LinkedIn describes them, and how many looked in private mode. Premium adds a range and highlights: top location, industry and company, and the companies viewers work at.",
|
|
6525
|
+
usage: "lnrelay viewers [--days 7|14|28|90|365] [--compact | --fields a,b,c]",
|
|
6291
6526
|
audience: ["cli", "mcp"],
|
|
6292
6527
|
risk: "read",
|
|
6293
6528
|
implemented: true
|
|
@@ -6500,7 +6735,7 @@ var POSITION = {
|
|
|
6500
6735
|
var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${POSITION.editScreen}"`;
|
|
6501
6736
|
function listPositions(stream) {
|
|
6502
6737
|
if (readModel(stream) === null && !stream.includes(EDIT_NAV2) && !stream.includes('"rows"')) {
|
|
6503
|
-
return
|
|
6738
|
+
return drift12("the Experience screen could not be read");
|
|
6504
6739
|
}
|
|
6505
6740
|
const positions = [];
|
|
6506
6741
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -6508,27 +6743,27 @@ function listPositions(stream) {
|
|
|
6508
6743
|
for (; ; ) {
|
|
6509
6744
|
i = stream.indexOf(EDIT_NAV2, i);
|
|
6510
6745
|
if (i === -1) break;
|
|
6511
|
-
const
|
|
6746
|
+
const text7 = balanced(stream, i);
|
|
6512
6747
|
i += EDIT_NAV2.length;
|
|
6513
|
-
if (
|
|
6514
|
-
const payload = JSON.parse(
|
|
6748
|
+
if (text7 === null) continue;
|
|
6749
|
+
const payload = JSON.parse(text7).requestedArguments?.payload;
|
|
6515
6750
|
const id = payload?.positionId;
|
|
6516
6751
|
if (typeof id !== "string" || seen.has(id) || payload === void 0) continue;
|
|
6517
6752
|
seen.add(id);
|
|
6518
6753
|
positions.push({ positionId: id, title: String(payload.title ?? ""), payload });
|
|
6519
6754
|
}
|
|
6520
6755
|
if (positions.length === 0 && !stream.includes('"rows"') && !stream.includes("Experience")) {
|
|
6521
|
-
return
|
|
6756
|
+
return drift12("the Experience screen listed no roles and did not look like one");
|
|
6522
6757
|
}
|
|
6523
6758
|
return { ok: true, positions };
|
|
6524
6759
|
}
|
|
6525
6760
|
function readPositionForm(stream) {
|
|
6526
6761
|
const model = readModel(stream);
|
|
6527
|
-
if (model === null) return
|
|
6762
|
+
if (model === null) return drift12("the position form carried no initial values");
|
|
6528
6763
|
const media = findRequest(stream, POSITION.media);
|
|
6529
6764
|
const prefix = media?.payload.formIdPrefix;
|
|
6530
6765
|
if (media === null || typeof prefix !== "string") {
|
|
6531
|
-
return
|
|
6766
|
+
return drift12("the position form carried no save step (uploadPositionMedia)");
|
|
6532
6767
|
}
|
|
6533
6768
|
const del = findRequest(stream, POSITION.delete);
|
|
6534
6769
|
return {
|
|
@@ -6561,7 +6796,7 @@ function mediaBody(form, model) {
|
|
|
6561
6796
|
}
|
|
6562
6797
|
function saveFromReply(reply2) {
|
|
6563
6798
|
const args = findRequest(reply2, POSITION.save);
|
|
6564
|
-
return args === null ?
|
|
6799
|
+
return args === null ? drift12("the media step did not hand back the save action") : { ok: true, args };
|
|
6565
6800
|
}
|
|
6566
6801
|
function positionSaveBody(save, model, screen) {
|
|
6567
6802
|
const sending = new Map(model);
|
|
@@ -6573,7 +6808,7 @@ function positionSaveBody(save, model, screen) {
|
|
|
6573
6808
|
}
|
|
6574
6809
|
function deleteBody(form) {
|
|
6575
6810
|
if (form.del === null)
|
|
6576
|
-
return
|
|
6811
|
+
return drift12("this form has no delete action (it is not an existing role)");
|
|
6577
6812
|
const states = wireStates(keysOf(form.del), form.model, resolver);
|
|
6578
6813
|
if (!Array.isArray(states)) return states;
|
|
6579
6814
|
return { ok: true, body: requestBody(POSITION.delete, form.del, states, form.screen) };
|
|
@@ -6918,13 +7153,14 @@ async function runSkills(quiet = false) {
|
|
|
6918
7153
|
var SERVER_REQUEST = "https://www.linkedin.com/flagship-web/rsc-action/actions/server-request";
|
|
6919
7154
|
var VIEWERS_URL = `${SERVER_REQUEST}?sduiid=WvmpEntityList`;
|
|
6920
7155
|
var VIEW_TOTALS_URL = `${SERVER_REQUEST}?sduiid=WvmpAnalytics`;
|
|
7156
|
+
var VIEWERS_REFERER = "https://www.linkedin.com/analytics/profile-views/";
|
|
6921
7157
|
var RANGE = "WvmpSearchFilterType_DATE_RANGE";
|
|
6922
7158
|
var META = { $type: "proto.sdui.common.RequestMetadata" };
|
|
6923
|
-
function serverRequest(requestId, stateKey, payload) {
|
|
7159
|
+
function serverRequest(requestId, stateKey, payload, days) {
|
|
6924
7160
|
const state = {
|
|
6925
7161
|
key: stateKey,
|
|
6926
7162
|
namespace: "MemoryNamespace",
|
|
6927
|
-
value: [],
|
|
7163
|
+
value: days === void 0 ? [] : [`WvmpSearchFilterTimeRange_LAST_${days}_DAYS`],
|
|
6928
7164
|
originalProtoCase: "stringListValue",
|
|
6929
7165
|
protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: stateKey } }
|
|
6930
7166
|
};
|
|
@@ -6956,28 +7192,36 @@ function serverRequest(requestId, stateKey, payload) {
|
|
|
6956
7192
|
}
|
|
6957
7193
|
};
|
|
6958
7194
|
}
|
|
6959
|
-
function viewersBody() {
|
|
6960
|
-
return serverRequest(
|
|
6961
|
-
|
|
6962
|
-
|
|
7195
|
+
function viewersBody(days) {
|
|
7196
|
+
return serverRequest(
|
|
7197
|
+
"WvmpEntityList",
|
|
7198
|
+
`entityListQueryFilterPrefix${RANGE}`,
|
|
7199
|
+
{ sortType: "ProfileViewSortType_TIME_DESCENDING" },
|
|
7200
|
+
days
|
|
7201
|
+
);
|
|
6963
7202
|
}
|
|
6964
|
-
function viewTotalsBody() {
|
|
6965
|
-
return serverRequest(
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
7203
|
+
function viewTotalsBody(days) {
|
|
7204
|
+
return serverRequest(
|
|
7205
|
+
"WvmpAnalytics",
|
|
7206
|
+
`analyticsFieldsFilterPrefix${RANGE}`,
|
|
7207
|
+
{
|
|
7208
|
+
highlightCardDimensions: [
|
|
7209
|
+
"DimensionType_LOCATION",
|
|
7210
|
+
"DimensionType_INDUSTRY",
|
|
7211
|
+
"DimensionType_ORGANIZATION"
|
|
7212
|
+
],
|
|
7213
|
+
detailsCardDimensions: ["DimensionType_ORGANIZATION"],
|
|
7214
|
+
highlightCardResultCount: 4,
|
|
7215
|
+
detailsCardResultCount: 23
|
|
7216
|
+
},
|
|
7217
|
+
days
|
|
7218
|
+
);
|
|
6975
7219
|
}
|
|
6976
|
-
var
|
|
7220
|
+
var drift13 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
6977
7221
|
var unquote4 = (s) => JSON.parse(`"${s}"`);
|
|
6978
7222
|
var STR2 = '((?:[^"\\\\]|\\\\.)+)';
|
|
6979
7223
|
var ITEM = /"viewName":"viewer-list-item"(?:,"impressionThresholds":\[[^\]]*\])?[^{}]*"semanticPosition"/;
|
|
6980
|
-
var TEXT_PROPS = /"textProps":\{"fontFamily":"[^"]*","fontSize":"(\w+)","fontStyle":"[^"]*","fontWeight":"(\w+)"
|
|
7224
|
+
var TEXT_PROPS = /"textProps":\{"fontFamily":"[^"]*","fontSize":"(\w+)","fontStyle":"[^"]*","fontWeight":"(\w+)"(?:,"\w+":"[^"]*")*?,"children":/g;
|
|
6981
7225
|
var OWN_TEXT = new RegExp(`^\\["${STR2}"\\]`);
|
|
6982
7226
|
var NESTED_TEXT = new RegExp(`\\[null,"${STR2}"`);
|
|
6983
7227
|
var LINK2 = new RegExp(`"urlValue":\\{"\\$case":"url","url":"${STR2}"`);
|
|
@@ -6988,8 +7232,8 @@ function textsOf(row) {
|
|
|
6988
7232
|
const after = row.slice((m.index ?? 0) + m[0].length, (m.index ?? 0) + m[0].length + 600);
|
|
6989
7233
|
const raw = after.match(OWN_TEXT)?.[1] ?? after.match(NESTED_TEXT)?.[1];
|
|
6990
7234
|
if (raw === void 0) return [];
|
|
6991
|
-
const
|
|
6992
|
-
return
|
|
7235
|
+
const text7 = unquote4(raw).trim();
|
|
7236
|
+
return text7 === "" ? [] : [{ size: m[1], weight: m[2], text: text7 }];
|
|
6993
7237
|
});
|
|
6994
7238
|
}
|
|
6995
7239
|
function viewerOf(row, id) {
|
|
@@ -7042,27 +7286,32 @@ function idsByViewer(rows, items) {
|
|
|
7042
7286
|
const ids = /* @__PURE__ */ new Map();
|
|
7043
7287
|
for (const row of rows.byId.values()) {
|
|
7044
7288
|
let current;
|
|
7289
|
+
let from = 0;
|
|
7290
|
+
const settle = (id) => {
|
|
7291
|
+
if (current !== void 0 && id !== void 0 && !ids.has(current)) ids.set(current, id);
|
|
7292
|
+
};
|
|
7045
7293
|
for (const m of row.matchAll(REF2)) {
|
|
7046
7294
|
const ref = m[1];
|
|
7295
|
+
const at = m.index ?? 0;
|
|
7296
|
+
settle(row.slice(from, at).match(PROFILE_ID2)?.[0]);
|
|
7297
|
+
from = at + m[0].length;
|
|
7047
7298
|
if (items.has(ref)) current = ref;
|
|
7048
|
-
else if (current !== void 0 && !ids.has(current))
|
|
7049
|
-
const id = idUnder(rows, ref, items);
|
|
7050
|
-
if (id !== void 0) ids.set(current, id);
|
|
7051
|
-
}
|
|
7299
|
+
else if (current !== void 0 && !ids.has(current)) settle(idUnder(rows, ref, items));
|
|
7052
7300
|
}
|
|
7301
|
+
settle(row.slice(from).match(PROFILE_ID2)?.[0]);
|
|
7053
7302
|
}
|
|
7054
7303
|
return ids;
|
|
7055
7304
|
}
|
|
7056
7305
|
function parseViewers(stream) {
|
|
7057
7306
|
if (!stream.includes('"viewName":"viewer-list"'))
|
|
7058
|
-
return
|
|
7307
|
+
return drift13("the profile viewers answer was not the viewer list");
|
|
7059
7308
|
const rows = new Rows(stream);
|
|
7060
7309
|
const items = new Set([...rows.byId].filter(([, row]) => ITEM.test(row)).map(([id]) => id));
|
|
7061
7310
|
const ids = idsByViewer(rows, items);
|
|
7062
7311
|
const viewers = [...items].flatMap((id) => viewerOf(rows.byId.get(id) ?? "", ids.get(id)) ?? []);
|
|
7063
7312
|
const shown = Math.max(items.size, (stream.match(new RegExp(ITEM, "g")) ?? []).length);
|
|
7064
7313
|
if (shown > 0 && viewers.length === 0)
|
|
7065
|
-
return
|
|
7314
|
+
return drift13(`${shown} profile viewers were shown but none could be read`);
|
|
7066
7315
|
let privateViewers;
|
|
7067
7316
|
for (const [id, row] of rows.byId) {
|
|
7068
7317
|
if (items.has(id) || privateViewers !== void 0) continue;
|
|
@@ -7076,13 +7325,41 @@ function parseViewers(stream) {
|
|
|
7076
7325
|
}
|
|
7077
7326
|
return privateViewers === void 0 ? { ok: true, viewers } : { ok: true, viewers, privateViewers };
|
|
7078
7327
|
}
|
|
7328
|
+
var textsIn = (s) => [...s.matchAll(PLAIN_TEXT)].map((m) => unquote4(m[1]).trim());
|
|
7329
|
+
function highlightsOf(stream) {
|
|
7330
|
+
const from = stream.indexOf('"viewName":"highlights"');
|
|
7331
|
+
if (from === -1) return [];
|
|
7332
|
+
const to = stream.indexOf('"viewName":"details"', from);
|
|
7333
|
+
const texts3 = textsIn(stream.slice(from, to === -1 ? void 0 : to)).slice(1);
|
|
7334
|
+
const out = [];
|
|
7335
|
+
for (let i = 0; i + 1 < texts3.length; i += 2)
|
|
7336
|
+
out.push({ value: texts3[i], label: texts3[i + 1] });
|
|
7337
|
+
return out;
|
|
7338
|
+
}
|
|
7339
|
+
function companiesOf(texts3) {
|
|
7340
|
+
const seen = /* @__PURE__ */ new Map();
|
|
7341
|
+
texts3.forEach((t, i) => {
|
|
7342
|
+
const share3 = t.match(/^\((\d+)\s*%\)$/)?.[1];
|
|
7343
|
+
const name = texts3[i - 1];
|
|
7344
|
+
if (share3 !== void 0 && name !== void 0 && !seen.has(name)) seen.set(name, Number(share3));
|
|
7345
|
+
});
|
|
7346
|
+
return [...seen].map(([name, share3]) => ({ name, share: share3 }));
|
|
7347
|
+
}
|
|
7079
7348
|
function parseViewTotals(stream) {
|
|
7080
|
-
const texts3 =
|
|
7349
|
+
const texts3 = textsIn(stream);
|
|
7081
7350
|
const at = texts3.findIndex((t) => /^\d[\d.,\s]*$/.test(t));
|
|
7082
|
-
if (at === -1) return
|
|
7351
|
+
if (at === -1) return drift13("the profile view totals carried no number");
|
|
7083
7352
|
const total = Number(texts3[at].replace(/\D/g, ""));
|
|
7084
|
-
const
|
|
7085
|
-
|
|
7353
|
+
const label = texts3[at + 1];
|
|
7354
|
+
const highlights = highlightsOf(stream);
|
|
7355
|
+
const companies2 = companiesOf(texts3);
|
|
7356
|
+
return {
|
|
7357
|
+
ok: true,
|
|
7358
|
+
total,
|
|
7359
|
+
...label !== void 0 && /\d/.test(label) ? { period: label } : {},
|
|
7360
|
+
...highlights.length > 0 ? { highlights } : {},
|
|
7361
|
+
...companies2.length > 0 ? { companies: companies2 } : {}
|
|
7362
|
+
};
|
|
7086
7363
|
}
|
|
7087
7364
|
|
|
7088
7365
|
// src/commands/viewers.ts
|
|
@@ -7092,7 +7369,14 @@ function liveFetch10(quiet) {
|
|
|
7092
7369
|
return err("viewers", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
7093
7370
|
const client = createLiveClient(session.session, void 0, quiet);
|
|
7094
7371
|
return async (url, body, spendClass) => {
|
|
7095
|
-
const r = await client.request({
|
|
7372
|
+
const r = await client.request({
|
|
7373
|
+
url,
|
|
7374
|
+
method: "POST",
|
|
7375
|
+
body,
|
|
7376
|
+
headers: { referer: VIEWERS_REFERER },
|
|
7377
|
+
spendClass,
|
|
7378
|
+
operation: "viewers"
|
|
7379
|
+
});
|
|
7096
7380
|
if (!r.ok) return r;
|
|
7097
7381
|
return { ok: true, raw: r.classification.raw ?? "" };
|
|
7098
7382
|
};
|
|
@@ -7101,15 +7385,18 @@ var compactViewer = (v) => "anonymous" in v ? line(["anonymous", v.description,
|
|
|
7101
7385
|
async function runViewers(opts = {}, fetch2) {
|
|
7102
7386
|
const get = fetch2 ?? liveFetch10(opts.quiet === true);
|
|
7103
7387
|
if (typeof get !== "function") return get;
|
|
7104
|
-
const totalsRes = await get(VIEW_TOTALS_URL, viewTotalsBody(), "page");
|
|
7388
|
+
const totalsRes = await get(VIEW_TOTALS_URL, viewTotalsBody(opts.days), "page");
|
|
7105
7389
|
const totals = totalsRes.ok ? parseViewTotals(totalsRes.raw) : totalsRes;
|
|
7106
|
-
const listRes = await get(VIEWERS_URL, viewersBody(), "page");
|
|
7390
|
+
const listRes = await get(VIEWERS_URL, viewersBody(opts.days), "page");
|
|
7107
7391
|
const list = listRes.ok ? parseViewers(listRes.raw) : listRes;
|
|
7108
7392
|
if (!list.ok) return err("viewers", list.code, list.message, list.hint);
|
|
7109
7393
|
const shown = list.viewers.length;
|
|
7110
|
-
const
|
|
7394
|
+
const accounted = totals.ok && (totals.total <= shown || shown + (list.privateViewers ?? 0) === totals.total);
|
|
7395
|
+
const state = !totals.ok ? "unknown" : accounted ? "complete" : "partial";
|
|
7396
|
+
const { ok: _ok, ...summary } = totals.ok ? totals : { ok: false };
|
|
7111
7397
|
return ok("viewers", {
|
|
7112
|
-
...
|
|
7398
|
+
...opts.days !== void 0 ? { days: opts.days } : {},
|
|
7399
|
+
...totals.ok ? summary : { totalError: `${totals.code}: ${totals.message}` },
|
|
7113
7400
|
...list.privateViewers !== void 0 ? { privateViewers: list.privateViewers } : {},
|
|
7114
7401
|
items: shape(list.viewers, opts, compactViewer),
|
|
7115
7402
|
meta: { state, operation: "viewers", returnedCount: shown }
|
|
@@ -7368,19 +7655,21 @@ function buildServer() {
|
|
|
7368
7655
|
};
|
|
7369
7656
|
server.tool(
|
|
7370
7657
|
"jobs",
|
|
7371
|
-
`Search LinkedIn jobs with every filter the jobs page has. 1 job-search call per 100 results (150 a day). Rows carry id, title, company, location, workplace, listed (date), easyApply, promoted, salary when shown, url. RANK ON THOSE, then call \`job\` on finalists for the description and apply link; \`details:true\` reads every row in full, 100 per job read (60 a day). Pass several keyword sets as a list to search them all with the same filters in one call: jobs found by several come back once, with \`matched\` naming the sets that found them, most-matched first; \`meta.searches\` reports each set and \`meta.duplicates\` how many repeats were merged. Ids for company/industry/title/place/filter come from \`job_filters\`. \`data.location\` is the place a typed location resolved to: check it. \`meta.claimedCount\` is LinkedIn's total; \`meta.next\` is the start for the next page; LinkedIn serves at most 1000 per search. ${READING_CONTRACT} ${NO_RETRY}`,
|
|
7658
|
+
`Search LinkedIn jobs with every filter the jobs page has. 1 job-search call per 100 results (150 a day). Rows carry id, title, company, location, workplace, listed (date), easyApply, promoted, salary when shown, url. RANK ON THOSE, then call \`job\` on finalists for the description and apply link; \`details:true\` reads every row in full, 100 per job read (60 a day). Pass several keyword sets as a list to search them all with the same filters in one call: jobs found by several come back once, with \`matched\` naming the sets that found them, most-matched first; \`meta.searches\` reports each set and \`meta.duplicates\` how many repeats were merged. Ids for company/industry/title/place/filter come from \`job_filters\`. \`data.location\` is the place a typed location resolved to: check it. \`meta.claimedCount\` is LinkedIn's total; \`meta.next\` is the start for the next page; LinkedIn serves at most 1000 per search. topApplicant: true (Premium) lists instead the jobs where LinkedIn says the user would be a top applicant, 100 per call; it takes no keywords, location or filters. ${READING_CONTRACT} ${NO_RETRY}`,
|
|
7372
7659
|
{
|
|
7373
7660
|
...jobQuery,
|
|
7661
|
+
topApplicant: z.boolean().optional().describe("Premium: LinkedIn's list of jobs where the user would be a top applicant"),
|
|
7374
7662
|
limit: z.number().int().min(1).max(1e3).optional().describe("per keyword set; default 25"),
|
|
7375
7663
|
start: z.number().int().min(0).optional(),
|
|
7376
7664
|
details: z.boolean().optional().describe("read each job: apply link, applicants"),
|
|
7377
7665
|
description: z.boolean().optional().describe("with details, keep full descriptions"),
|
|
7378
7666
|
compact: z.boolean().optional().describe("one line per job")
|
|
7379
7667
|
},
|
|
7380
|
-
async ({ limit, start, details, description, compact: compact2, ...q }) => reply(
|
|
7668
|
+
async ({ limit, start, details, description, compact: compact2, topApplicant, ...q }) => reply(
|
|
7381
7669
|
await runJobs(
|
|
7382
7670
|
{
|
|
7383
7671
|
...jobRequest(q, limit ?? 25),
|
|
7672
|
+
...topApplicant === true ? { collection: "top-applicant" } : {},
|
|
7384
7673
|
...start !== void 0 ? { start } : {},
|
|
7385
7674
|
...details !== void 0 ? { details } : {},
|
|
7386
7675
|
...description !== void 0 ? { description } : {}
|
|
@@ -7391,12 +7680,13 @@ function buildServer() {
|
|
|
7391
7680
|
);
|
|
7392
7681
|
server.tool(
|
|
7393
7682
|
"job",
|
|
7394
|
-
`LinkedIn jobs by id or URL, in full: description, apply {type: external | easy-apply, url}, company, location, workplace, employmentType, applicants, listed/expires, state (LISTED or CLOSED), and whether the user already applied or saved it. One id returns the job; several return {items, meta}, read 100 per job read (60 a day), so pass all finalists in one call. meta.unread lists ids LinkedIn did not return. team: true adds hiringTeam [{name, id, url, headline, degree, role ("Job poster"), verified}] per job \u2014 who posted it and who is hiring \u2014 one page call (60 a day) per job; [] means LinkedIn shows no one, and hiringTeamError says why one could not be read.
|
|
7683
|
+
`LinkedIn jobs by id or URL, in full: description, apply {type: external | easy-apply, url}, company, location, workplace, employmentType, applicants, listed/expires, state (LISTED or CLOSED), and whether the user already applied or saved it. One id returns the job; several return {items, meta}, read 100 per job read (60 a day), so pass all finalists in one call. meta.unread lists ids LinkedIn did not return. team: true adds hiringTeam [{name, id, url, headline, degree, role ("Job poster"), verified}] per job \u2014 who posted it and who is hiring \u2014 one page call (60 a day) per job; [] means LinkedIn shows no one, and hiringTeamError says why one could not be read. insights: true (Premium) adds premium {applicants {total, lastDay, seniority [{level, share, count}], education [{degree, share}]}, company {name, headcount {asOf, now, sixMonthsAgo, yearAgo, twoYearsAgo, growth1y (%)}, function {name, now, \u2026} (the job's function), medianTenure, competitors [{name, industry, url}], hiring, priorities, landscape (LinkedIn's generated text)}}, one more job read per job; premiumError says why they could not be read. ` + NO_RETRY,
|
|
7395
7684
|
{
|
|
7396
7685
|
job: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).describe("job id, /jobs/view/ URL or ?currentJobId= URL, or a list of them"),
|
|
7397
|
-
team: z.boolean().optional().describe("also read each job's hiring team")
|
|
7686
|
+
team: z.boolean().optional().describe("also read each job's hiring team"),
|
|
7687
|
+
insights: z.boolean().optional().describe("Premium: who applied, and the company's headcount and insights")
|
|
7398
7688
|
},
|
|
7399
|
-
async ({ job, team }) => reply(await runJob(job, {}, void 0, { team: team === true }))
|
|
7689
|
+
async ({ job, team, insights }) => reply(await runJob(job, {}, void 0, { team: team === true, insights: insights === true }))
|
|
7400
7690
|
);
|
|
7401
7691
|
server.tool(
|
|
7402
7692
|
"job_filters",
|
|
@@ -7514,9 +7804,17 @@ function buildServer() {
|
|
|
7514
7804
|
);
|
|
7515
7805
|
server.tool(
|
|
7516
7806
|
"viewers",
|
|
7517
|
-
|
|
7518
|
-
{
|
|
7519
|
-
|
|
7807
|
+
`Who viewed the user's profile, as their profile-views page shows it: total, privateViewers (a count only), and items \u2014 named viewers {name, id, url, degree, headline, viewed} and anonymous ones {anonymous, description, viewed, searchUrl}. Premium names every viewer, takes days (7, 14, 28, 90 or 365; default the page's 90) and adds highlights [{label, value}] (top location, industry, company) and companies [{name, share}]. A free account is shown up to 3. meta.state is complete only when the named and private add up to total. Degree, labels and times are in the user's language. 2 page calls. ${NO_RETRY}`,
|
|
7808
|
+
{
|
|
7809
|
+
days: z.union([z.literal(7), z.literal(14), z.literal(28), z.literal(90), z.literal(365)]).optional().describe("the range in days (Premium)"),
|
|
7810
|
+
compact: z.boolean().optional().describe("one line a viewer")
|
|
7811
|
+
},
|
|
7812
|
+
async ({ days, compact: compact2 }) => reply(
|
|
7813
|
+
await runViewers({
|
|
7814
|
+
...compact2 === true ? { compact: true } : {},
|
|
7815
|
+
...days !== void 0 ? { days } : {}
|
|
7816
|
+
})
|
|
7817
|
+
)
|
|
7520
7818
|
);
|
|
7521
7819
|
server.tool(
|
|
7522
7820
|
"events",
|
|
@@ -7608,7 +7906,7 @@ function buildServer() {
|
|
|
7608
7906
|
text: z.string().optional().describe("the reply"),
|
|
7609
7907
|
remove: z.string().optional().describe("a draft id to delete")
|
|
7610
7908
|
},
|
|
7611
|
-
async ({ conversation, text:
|
|
7909
|
+
async ({ conversation, text: text7, remove }) => reply(remove !== void 0 ? runDraftRemove(remove) : await runDraft(conversation, text7))
|
|
7612
7910
|
);
|
|
7613
7911
|
server.tool(
|
|
7614
7912
|
"drafts",
|