ilml-plugin-linkedin 1.12.0 → 1.13.1

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.
@@ -1,12 +1,246 @@
1
- var he=Object.defineProperty;var X=(e,n)=>()=>(e&&(n=e(e=0)),n);var ge=(e,n)=>{for(var s in n)he(e,s,{get:n[s],enumerable:!0})};async function p(e){let n=Math.floor(Math.random()*2001),s=e+n;return new Promise(t=>setTimeout(t,s))}async function ee(e){return await e.evaluate(()=>{let n=document.querySelectorAll("div.artdeco-modal--is-open");for(let t of n){let l=t.innerText||"",y=l.includes("Premium")||l.includes("premium")||l.includes("Upgrade")||l.includes("upgrade"),u=l.includes("Try for")||l.includes("free trial")||l.includes("/month")||l.includes("per month")||l.includes("Start my")||l.includes("Subscribe"),f=l.includes("Get hired faster")||l.includes("Get hired 2x");if(y||u||f){let v=t.querySelector('button[aria-label="Dismiss"]')||t.querySelector("button.artdeco-modal__dismiss")||t.querySelector("button[data-test-modal-close-btn]");if(v)return v.click(),{dismissed:!0,matched:l.substring(0,80)};let E=t.querySelectorAll("button");for(let r of E){let m=r.innerText?.trim().toLowerCase()||"",d=r.getAttribute("aria-label")?.toLowerCase()||"";if(m==="not now"||m==="no thanks"||m==="dismiss"||d.includes("dismiss"))return r.click(),{dismissed:!0,matched:l.substring(0,80)}}}}let s=document.querySelector(".premium-upsell-link")||document.querySelector("[data-test-premium-upsell]")||document.querySelector(".premium-hub-upsell");if(s){let t=s.closest('[class*="modal"]')?.querySelector('button[aria-label="Dismiss"]')||s.closest('[class*="banner"]')?.querySelector('button[aria-label="Close"]');if(t)return t.click(),{dismissed:!0,matched:"premium-banner"}}return!1})}var F=X(()=>{});var ie={};ge(ie,{extractExperienceFromDetails:()=>qe});async function qe(e,n){let s=n.replace(/\/+$/,"")+"/details/experience/";try{await e.goto(s,{waitUntil:"domcontentloaded",timeout:6e4}),await p(3e3);let t=e.url();if(/\/(login|authwall|checkpoint)/i.test(t))throw new Error(`Session expired \u2014 bounced to ${t} when fetching /details/experience/`);for(let y=0;y<5;y++)await e.evaluate(()=>window.scrollTo(0,document.body.scrollHeight)),await p(900);await p(1e3);let l=0;for(;l<5&&await e.evaluate(()=>{for(let u of document.querySelectorAll("button"))if(/^Load more$/i.test((u.textContent||"").trim()))return u.click(),!0;return!1});)l++,await p(1500),await e.evaluate(()=>window.scrollTo(0,document.body.scrollHeight)),await p(700);return await e.evaluate(()=>{let y=document.querySelector("main");if(!y)return[];function u(r){let m=[];for(let d of r.querySelectorAll("div")){let g=Array.from(d.children).filter(k=>k.tagName==="DIV");if(g.length<3)continue;let b=g.filter(k=>(k.textContent||"").trim().length>50);b.length<3||(d.textContent||"").length<500||m.push({el:d,count:b.length,totalText:(d.textContent||"").length})}return m.sort((d,g)=>g.count-d.count||d.totalText-g.totalText),m[0]?.el}let f=u(y);if(!f)return[];let v=Array.from(f.children).filter(r=>r.tagName==="DIV").filter(r=>(r.textContent||"").trim().length>50);function E(r){let m=r[0]||null,d=null,g=null;if(r[1]){let c=r[1].split("\xB7").map(C=>C.trim());d=c[0]||null,c[1]&&(g=c[1])}let b=r.findIndex(c=>/(\d{4}|present)/i.test(c)&&/(-|–|—)/i.test(c)&&c.length<80),k=null,$=null;if(b>=0){let c=r[b].split("\xB7").map(C=>C.trim());k=c[0]||null,c[1]&&($=c[1])}let S=null,M=-1;if(b>=0&&r[b+1]){let c=r[b+1],C=/^[>*\-•]|^&gt;/.test(c),R=/https?:\/\//.test(c),B=/\d{4}/.test(c),D=/,/.test(c)||/\bArea\b|\bRegion\b|\bProvince\b|\bCountry\b|, [A-Z]{2}\b/.test(c);!C&&!R&&!B&&c.length<100&&D&&(S=c,M=b+1)}let q=null,L=-1,I=r[r.length-1];if(I&&/and\s+\+\d+\s+skills?$/i.test(I)){L=r.length-1;let c=I.match(/^(.+?)\s+and\s+\+(\d+)\s+skills?$/i);c&&(q={listed:c[1].split(",").map(C=>C.trim()),additional:parseInt(c[2],10)})}let j=new Set([0,1,b,M,L].filter(c=>c>=0)),O=r.filter((c,C)=>!j.has(C)),N=O.length>0?O.join(`
1
+ var Ie=Object.defineProperty;var de=(e,t)=>()=>(e&&(t=e(e=0)),t);var De=(e,t)=>{for(var o in t)Ie(e,o,{get:t[o],enumerable:!0})};async function d(e){let t=Math.floor(Math.random()*2001),o=e+t;return new Promise(n=>setTimeout(n,o))}async function me(e){return await e.evaluate(()=>{let t=document.querySelectorAll("div.artdeco-modal--is-open");for(let n of t){let s=n.innerText||"",m=s.includes("Premium")||s.includes("premium")||s.includes("Upgrade")||s.includes("upgrade"),u=s.includes("Try for")||s.includes("free trial")||s.includes("/month")||s.includes("per month")||s.includes("Start my")||s.includes("Subscribe"),h=s.includes("Get hired faster")||s.includes("Get hired 2x");if(m||u||h){let D=n.querySelector('button[aria-label="Dismiss"]')||n.querySelector("button.artdeco-modal__dismiss")||n.querySelector("button[data-test-modal-close-btn]");if(D)return D.click(),{dismissed:!0,matched:s.substring(0,80)};let $=n.querySelectorAll("button");for(let l of $){let S=l.innerText?.trim().toLowerCase()||"",f=l.getAttribute("aria-label")?.toLowerCase()||"";if(S==="not now"||S==="no thanks"||S==="dismiss"||f.includes("dismiss"))return l.click(),{dismissed:!0,matched:s.substring(0,80)}}}}let o=document.querySelector(".premium-upsell-link")||document.querySelector("[data-test-premium-upsell]")||document.querySelector(".premium-hub-upsell");if(o){let n=o.closest('[class*="modal"]')?.querySelector('button[aria-label="Dismiss"]')||o.closest('[class*="banner"]')?.querySelector('button[aria-label="Close"]');if(n)return n.click(),{dismissed:!0,matched:"premium-banner"}}return!1})}var j=de(()=>{});var we={};De(we,{extractCertificationsFromDetails:()=>Qe,extractEducationFromDetails:()=>Ge,extractExperienceFromDetails:()=>Ye,extractFeaturedFromDetails:()=>Ke,extractRecommendationsFromDetails:()=>Ze,extractSkillsFromDetails:()=>ze});async function Ye(e,t){let o=t.replace(/\/+$/,"")+"/details/experience/";try{await e.goto(o,{waitUntil:"domcontentloaded",timeout:6e4}),await d(3e3);let n=e.url();if(/\/(login|authwall|checkpoint)/i.test(n))throw new Error(`Session expired \u2014 bounced to ${n} when fetching /details/experience/`);for(let m=0;m<5;m++)await e.evaluate(()=>window.scrollTo(0,document.body.scrollHeight)),await d(900);await d(1e3);let s=0;for(;s<5&&await e.evaluate(()=>{for(let u of document.querySelectorAll("button"))if(/^Load more$/i.test((u.textContent||"").trim()))return u.click(),!0;return!1});)s++,await d(1500),await e.evaluate(()=>window.scrollTo(0,document.body.scrollHeight)),await d(700);return await e.evaluate(()=>{let m=document.querySelector("main");if(!m)return[];function u(l){let S=[];for(let f of l.querySelectorAll("div")){let p=Array.from(f.children).filter(x=>x.tagName==="DIV");if(p.length<3)continue;let w=p.filter(x=>(x.textContent||"").trim().length>50);w.length<3||(f.textContent||"").length<500||S.push({el:f,count:w.length,totalText:(f.textContent||"").length})}return S.sort((f,p)=>p.count-f.count||f.totalText-p.totalText),S[0]?.el}let h=u(m);if(!h)return[];let D=Array.from(h.children).filter(l=>l.tagName==="DIV").filter(l=>(l.textContent||"").trim().length>50);function $(l){let S=l[0]||null,f=null,p=null;if(l[1]){let a=l[1].split("\xB7").map(C=>C.trim());f=a[0]||null,a[1]&&(p=a[1])}let w=l.findIndex(a=>/(\d{4}|present)/i.test(a)&&/(-|–|—)/i.test(a)&&a.length<80),x=null,T=null;if(w>=0){let a=l[w].split("\xB7").map(C=>C.trim());x=a[0]||null,a[1]&&(T=a[1])}let M=null,J=-1;if(w>=0&&l[w+1]){let a=l[w+1],C=/^[>*\-•]|^&gt;/.test(a),P=/https?:\/\//.test(a),v=/\d{4}/.test(a),H=/,/.test(a)||/\bArea\b|\bRegion\b|\bProvince\b|\bCountry\b|, [A-Z]{2}\b/.test(a);!C&&!P&&!v&&a.length<100&&H&&(M=a,J=w+1)}let y=null,q=-1,E=l[l.length-1];if(E&&/and\s+\+\d+\s+skills?$/i.test(E)){q=l.length-1;let a=E.match(/^(.+?)\s+and\s+\+(\d+)\s+skills?$/i);a&&(y={listed:a[1].split(",").map(C=>C.trim()),additional:parseInt(a[2],10)})}let L=new Set([0,1,w,J,q].filter(a=>a>=0)),k=l.filter((a,C)=>!L.has(C)),Y=k.length>0?k.join(`
2
2
 
3
- `):null;return{title:m,company:d,employmentType:g,dates:k,duration:$,location:S,description:N,skills:q,_raw:r}}return v.map(r=>{let d=(r.innerText||"").trim().split(`
4
- `).map(g=>g.trim()).filter(g=>g&&g.length<5e3);return E(d)}).filter(r=>r.title)})}catch(t){if(/session expired|bounced to|authwall|checkpoint/i.test(t.message||""))throw t;return console.error(`extractExperienceFromDetails failed for ${n}: ${t.message?.slice(0,120)}`),[]}}var re=X(()=>{F()});import xe from"puppeteer";import{addExtra as _e}from"puppeteer-extra";import Ae from"puppeteer-extra-plugin-stealth";F();import{getPluginConfig as we}from"@ilivemylife/graph-sdk";var ye=await we();for(let[e,n]of Object.entries(ye))process.env[e]===void 0&&(process.env[e]=n);var be=process.env.LINKEDIN_NAME,T=Object.freeze({DRAFT:"draft",CONFIRMED:"confirmed",REJECTED:"rejected",NEEDS_REVIEW:"needs_review",SENT:"sent"}),Ue=Object.freeze(new Set([T.DRAFT,T.CONFIRMED,T.NEEDS_REVIEW])),Se=Object.freeze(new Set([T.DRAFT,T.CONFIRMED,T.REJECTED,T.NEEDS_REVIEW]));import te from"fs";import Ce from"path";var ve="cookies.json";function ke(){let e=process.env.ILML_SCOPE_DIR;return e?Ce.join(e,"plugins-state","linkedin","cookies.json"):ve}function ne(){let e=ke();if(!te.existsSync(e))throw new Error(`Cookies not found at ${e}. Run: ilml linkedin login`);let n;try{n=te.readFileSync(e,"utf-8")}catch(t){throw new Error(`Failed to read cookies at ${e}: ${t.message}. Run: ilml linkedin login`)}let s;try{s=JSON.parse(n)}catch{throw new Error(`Cookies file at ${e} is corrupted (invalid JSON). Run: ilml linkedin login`)}if(!Array.isArray(s)||s.length===0)throw new Error(`Cookies file at ${e} is empty or not an array. Run: ilml linkedin login`);return s}var oe=_e(xe);oe.use(Ae());async function se(){let e=await oe.launch({headless:!1,defaultViewport:null,protocolTimeout:3e5}),n=async()=>{console.log(`
5
- Closing browser...`);try{await e.close()}catch{}process.exit(0)};process.on("SIGINT",n),process.on("SIGTERM",n);let s=await e.newPage();await s.evaluateOnNewDocument(()=>{Object.defineProperty(navigator,"webdriver",{get:()=>{}})});try{let t=ne();await s.setCookie(...t),console.log(" Browser launched, cookies loaded.")}catch(t){console.error(`
6
- [!] ${t.message}
7
- `),await e.close(),process.exit(1)}return{browser:e,page:s}}F();import"dotenv/config";import*as h from"fs";import*as w from"path";import{fileURLToPath as Ee}from"url";var $e=Ee(import.meta.url),Ie=w.dirname(w.dirname($e)),_=process.env.DATA_DIR?w.resolve(process.env.DATA_DIR,"collected-profiles"):w.join(Ie,"collected-profiles"),Te=w.join(_,"people.json"),rt=w.join(_,"jobs.json"),lt=w.join(_,"quota.json"),at=w.join(_,"conversations.json"),ct=w.join(_,"sync-state.json"),ut=w.join(_,"application-questions.json"),dt=w.join(_,"profile-history");var U=null;function De(){h.existsSync(_)||h.mkdirSync(_,{recursive:!0})}function Me(e,n){if(!h.existsSync(e))return null;try{let s=JSON.parse(h.readFileSync(e,"utf-8"));try{h.copyFileSync(e,e+".backup")}catch{}return s}catch(s){console.error(`[!] ${n} is corrupted: ${s.message}`),console.error(` File: ${w.resolve(e)}`);let t=e+".backup";if(h.existsSync(t))try{let l=JSON.parse(h.readFileSync(t,"utf-8"));console.error(` Restored from ${t}`);try{h.copyFileSync(t,e)}catch{}return l}catch{console.error(" Backup also corrupted!")}console.error(` Starting with empty data. Old file preserved as ${e}.corrupted`);try{h.copyFileSync(e,e+".corrupted")}catch{}return null}}function V(){return U||(De(),U=Me(Te,"people.json")||{},U)}async function Le(e,n){let s=e.url();if(s.includes("/in/"))return!1;if(s.includes("/login")||s.includes("/authwall")||s.includes("/checkpoint"))throw new Error("Session expired \u2014 redirected to login. Run: npm run login");console.log(` Off-track: ${s.slice(0,80)}`),console.log(" Navigating back to profile..."),await e.goto(n,{waitUntil:"domcontentloaded",timeout:6e4}),await p(3e3);let t=e.url();return t.includes("/in/")||console.log(` Recovery failed \u2014 still on: ${t.slice(0,80)}`),!0}async function le(e,n,s={}){let{extractExperience:t=!1}=s;try{await e.goto(n,{waitUntil:"domcontentloaded",timeout:6e4}),await p(3e3),await ee(e)&&(console.log(" Dismissed Premium overlay"),await p(1500),await Le(e,n));let y=0;for(let v=0;v<2;v++){let E=await e.evaluate(()=>document.body.scrollHeight);for(let m=1;m<=6;m++)await e.evaluate(d=>window.scrollTo(0,d),E*m/6),await p(900);let r=await e.evaluate(()=>document.body.scrollHeight);if(r===y)break;y=r}await p(800);let u=await e.evaluate(()=>{let v=new Set(["Highlights","About","Activity","Experience","Education","Skills","Recommendations","Languages","Interests","Volunteer experience","Featured","Honors & awards","Honors and awards","Projects","Publications","Patents","Certifications","Licenses & certifications","Courses","Test scores","Organizations"]),E=new Set(["Ad Options","Don\u2019t want to see this","0 notifications","Explore Premium profiles","You might like","People you may know","Suggested for you","More profiles for you","Promoted"]),r=o=>{let i=(o||"").trim().replace(/^[·•]\s*/,"");return/^(1st|2nd|3rd|she\/her|he\/him|they\/them|their\/them)$/i.test(i)},m={name:null,title:null,location:null,currentCompany:null,currentSchool:null,connectionDegree:null,hasVerifiedBadge:!1,photoUrl:null,connectionsLevel:null,mutualConnectionsCount:null,followers:null,openToWork:!1,hiring:!1,about:null,topSkills:null,availableSections:[]},d=document.querySelector("main");if(!d)return m;let g=[...Array.from(d.querySelectorAll("h1")),...Array.from(d.querySelectorAll("h2"))],b=Array.from(d.querySelectorAll("h2")),k=g.find(o=>{let i=o.textContent&&o.textContent.trim(),a=(i||"").replace(/\s*\(\d+\)$/,"").trim();return i&&i.length>1&&i.length<100&&!v.has(a)&&!E.has(a)}),$=k?k.textContent.trim():null,S=k?k.parentElement:null;for(;S&&S!==d&&!Array.from(S.children).filter(i=>i.tagName==="P").some(i=>{let a=i.textContent&&i.textContent.trim();return a&&a.length>5&&!r(a)});)S=S.parentElement;let M=null,q=null,L=null,I=null;if(S&&S!==d){let o=Array.from(S.children).filter(a=>a.tagName==="P").filter(a=>{let A=a.textContent&&a.textContent.trim();return A&&A.length>5&&!r(A)});if(o[0]&&(M=o[0].textContent.trim()),o[1]){let a=o[1].textContent.trim().split(/\s*[·•]\s*/);q=a[0]||null,a.length>1&&(L=a.slice(1).join(" \xB7 "))}let i=Array.from(S.children).filter(a=>a.tagName==="DIV");for(let a=i.length-1;a>=0;a--){let A=i[a].textContent&&i[a].textContent.trim();if(A&&!($&&A.startsWith($))&&(I=A.split(/[·•]/)[0].trim(),I))break}}let j=null;if(S){let o=S.querySelectorAll("p, span, div");for(let i of o){let a=(i.textContent||"").trim().replace(/^[·•]\s*/,"");if(a==="1st"||a==="2nd"||a==="3rd"){j=a;break}}}let O=!!d.querySelector('svg[data-test-icon="verified"], [aria-label*="Verified" i]'),N=document.querySelector('main img[width="200"], button img[alt*="photo" i]'),c=N&&N.src||null,C=d.textContent||"",R=null,B=C.match(/(\d+\+?)\s+connections\b/i);B&&(R=B[1]+" connections");let D=null,J=C.match(/(\d+)\s+mutual connection/i),Y=C.match(/and\s+(\d+)\s+other mutual/i),ue=C.match(/([A-Z][\w'-]+(?:\s+[A-Z][\w'-]+)?)\s+and\s+([A-Z][\w'-]+(?:\s+[A-Z][\w'-]+)?)\s+are\s+mutual/);J?D=parseInt(J[1],10):Y?D=2+parseInt(Y[1],10):ue&&(D=2);let z=null,G=null,Q=b.find(o=>o.textContent&&o.textContent.trim()==="About");if(Q){let o=Q.parentElement;for(;o&&o.tagName!=="SECTION";)o=o.parentElement;if(o){let i=(o.textContent||"").trim();i=i.replace(/^About\s*/,"").trim();let a=i.match(/Top skills\s*(.+?)$/i);if(a){let H=a[1].split(/\b(?:see (?:more|less)|show (?:more|less))\b/i)[0].trim().split(/\s*[·•]\s*/).map(pe=>pe.trim()).filter(Boolean);H.length>0&&H.length<10&&(G=H)}i=i.split(/\n?…\s*more/i)[0].trim(),i=i.split(/\n?\.\.\.\s*more/i)[0].trim(),i=i.split(/\bTop skills\b/i)[0].trim(),i=i.split(/\b(?:see (?:more|less)|show (?:more|less))\b/i)[0].trim(),z=i||null}}let Z=null,K=b.find(o=>o.textContent&&o.textContent.trim()==="Activity");if(K){let o=K.parentElement;for(;o&&o.tagName!=="SECTION";)o=o.parentElement;if(o){let i=(o.textContent||"").slice(0,200).match(/([\d,]+)\s+followers/i);i&&(Z=parseInt(i[1].replace(/,/g,""),10))}}let de=[...new Set(b.map(o=>(o.textContent||"").trim().replace(/\s*\(\d+\)$/,"").trim()).filter(o=>o&&o.length>1&&o.length<60&&o!==$).filter(o=>v.has(o)))],P=document.body.textContent||"",fe=/#OpenToWork\b/i.test(P)||/\bOpen to work\b/.test(P),me=/#Hiring\b/i.test(P)||/\bI'?m hiring\b/i.test(P)||/\bWe are hiring\b/i.test(P);return{name:$,title:M,location:I,currentCompany:q,currentSchool:L,connectionDegree:j,hasVerifiedBadge:O,photoUrl:c,connectionsLevel:R,mutualConnectionsCount:D,followers:Z,openToWork:fe,hiring:me,about:z,topSkills:G,availableSections:de}});console.log(`Viewed: ${u.name} - ${u.title}`);let f=null;if(t){let{extractExperienceFromDetails:v}=await Promise.resolve().then(()=>(re(),ie));f=await v(e,n),console.log(` + Experience: ${f.length} entries`)}return{...u,profileUrl:n,...f!==null&&{experience:f}}}catch(l){console.error(`Error viewing profile ${n}:`,l.message);try{await e.goto("about:blank",{timeout:1e4}),await p(1e3)}catch{}if(/session expired|bounced to|authwall|checkpoint|redirected to login/i.test(l.message||""))throw l;return null}}F();var W=process.argv.slice(2),ae=W.filter(e=>e.startsWith("http")),ce=parseInt(W.find(e=>e.startsWith("--pick="))?.split("=")[1]||"0"),Pe=W.includes("--has-about");function Fe(e,n){return[...e].sort(()=>Math.random()-.5).slice(0,n)}function je(){if(ae.length>0)return ae.map(n=>({url:n,name:"(arg)"}));if(ce>0){let n=V(),s=Object.entries(n).filter(([t])=>t.startsWith("http")).filter(([,t])=>Pe?!!(t.about&&t.about.trim()):!t.about);return Fe(s,ce).map(([t,l])=>({url:t,name:l.name}))}let e=process.env.MY_LINKEDIN_URL;return e||(console.error("Pass a URL, use --pick=N, or set MY_LINKEDIN_URL in .env"),process.exit(1)),[{url:e,name:"(self)"}]}function x(e,n,s=80){if(n==null){console.log(` ${e.padEnd(20)} (null)`);return}let t=String(n),l=t.length>s?t.slice(0,s)+`\u2026 (+${t.length-s} chars)`:t;console.log(` ${e.padEnd(20)} ${l} [len=${t.length}]`)}async function Oe(){let e=je();console.log(`
3
+ `):null;return{title:S,company:f,employmentType:p,dates:x,duration:T,location:M,description:Y,skills:y,_raw:l}}return D.map(l=>{let f=(l.innerText||"").trim().split(`
4
+ `).map(p=>p.trim()).filter(p=>p&&p.length<5e3);return $(f)}).filter(l=>l.title)})}catch(n){if(/session expired|bounced to|authwall|checkpoint/i.test(n.message||""))throw n;return console.error(`extractExperienceFromDetails failed for ${t}: ${n.message?.slice(0,120)}`),[]}}async function O(e,t,o){let n=t.replace(/\/+$/,"")+`/details/${o}/`;await e.goto(n,{waitUntil:"domcontentloaded",timeout:6e4}),await d(3e3);let s=e.url();if(/\/(login|authwall|checkpoint)/i.test(s))throw new Error(`Session expired \u2014 bounced to ${s} when fetching /details/${o}/`);if(!s.toLowerCase().includes(`/details/${o.toLowerCase()}/`))throw new Error(`Section /details/${o}/ not available on profile (landed on ${s})`);for(let u=0;u<4;u++)await e.evaluate(()=>window.scrollTo(0,document.body.scrollHeight)),await d(700);await d(800);let m=0;for(;m<5&&await e.evaluate(()=>{for(let h of document.querySelectorAll("button"))if(/^Load more$/i.test((h.textContent||"").trim()))return h.click(),!0;return!1});)m++,await d(1300),await e.evaluate(()=>window.scrollTo(0,document.body.scrollHeight)),await d(600)}async function B(e,t,o,n){try{return await n()}catch(s){let m=s.message||"";if(/session expired|bounced to|authwall|checkpoint/i.test(m))throw s;return/not available on profile/i.test(m)?(console.log(` (${t}: section not on profile \u2014 skipped)`),[]):(console.error(`${o} failed for ${e}: ${m.slice(0,120)}`),[])}}async function Ke(e,t){return B(t,"featured","extractFeaturedFromDetails",async()=>(await O(e,t,"featured"),await e.evaluate(`(() => {
5
+ ${N}
6
+
7
+ const main = document.querySelector('main');
8
+ if (!main) return [];
9
+ const container = findEntryContainer(main);
10
+ if (!container) return [];
11
+
12
+ const entries = Array.from(container.children)
13
+ .filter(c => c.tagName === 'DIV')
14
+ .filter(c => (c.textContent || '').trim().length > 30);
15
+
16
+ return entries.map(entry => {
17
+ const raw = (entry.innerText || '').trim();
18
+ const lines = raw.split('\\n').map(l => l.trim()).filter(l => l && l.length < 2000);
19
+
20
+ // External link from any anchor inside the card (filter LinkedIn-internal)
21
+ const anchors = Array.from(entry.querySelectorAll('a[href]'));
22
+ const externalAnchor = anchors.find(a => {
23
+ const h = a.href || '';
24
+ return h.startsWith('http') &&
25
+ !h.includes('linkedin.com/in/') &&
26
+ !h.includes('linkedin.com/posts/') &&
27
+ !h.includes('#');
28
+ });
29
+ const url = externalAnchor?.href || anchors[0]?.href || null;
30
+
31
+ const title = lines[0] || null;
32
+ const caption = lines[1] && lines[1] !== title ? lines[1] : null;
33
+
34
+ return { title, caption, url, _raw: lines };
35
+ }).filter(e => {
36
+ if (!e.title) return false;
37
+ // Reject "People You May Know" sidebar cards: signature is
38
+ // exactly [title, "View"] with no url/caption beyond "View".
39
+ if (e._raw.length === 2 && e._raw[1] === 'View') return false;
40
+ // Reject "Other profiles you may know" widget cards: caption is
41
+ // just a connection-degree marker (e.g. "\xB7 3rd", "\xB7 2nd").
42
+ if (e.caption && /^\xB7\\s*\\d+(?:st|nd|rd|th)\\+?$/i.test(e.caption.trim())) return false;
43
+ return true;
44
+ });
45
+ })()`)))}async function Ge(e,t){return B(t,"education","extractEducationFromDetails",async()=>(await O(e,t,"education"),await e.evaluate(`(() => {
46
+ ${N}
47
+
48
+ const main = document.querySelector('main');
49
+ if (!main) return [];
50
+ const container = findEntryContainer(main);
51
+ if (!container) return [];
52
+
53
+ const entries = Array.from(container.children)
54
+ .filter(c => c.tagName === 'DIV')
55
+ .filter(c => (c.textContent || '').trim().length > 30);
56
+
57
+ return entries.map(entry => {
58
+ const raw = (entry.innerText || '').trim();
59
+ const lines = raw.split('\\n').map(l => l.trim()).filter(l => l && l.length < 5000);
60
+
61
+ const school = lines[0] || null;
62
+ const degree = lines[1] || null;
63
+ const dates = lines.find(l =>
64
+ /(\\d{4})/.test(l) &&
65
+ /(-|\u2013|\u2014)/i.test(l) &&
66
+ l.length < 80
67
+ ) || null;
68
+ const used = new Set([0, 1, dates ? lines.indexOf(dates) : -1].filter(i => i >= 0));
69
+ const descLines = lines.filter((_, i) => !used.has(i));
70
+ const description = descLines.length > 0 ? descLines.join(' / ') : null;
71
+
72
+ return { school, degree, dates, description, _raw: lines };
73
+ }).filter(e => {
74
+ if (!e.school) return false;
75
+ // Reject "People You May Know" sidebar cards: [title, "View"].
76
+ if (e._raw.length === 2 && e._raw[1] === 'View') return false;
77
+ // Reject related-profile widget: "degree" parsed as the
78
+ // connection-degree marker ("\xB7 3rd") instead of a real degree.
79
+ if (e.degree && /^\xB7\\s*\\d+(?:st|nd|rd|th)\\+?$/i.test(e.degree.trim())) return false;
80
+ return true;
81
+ });
82
+ })()`)))}async function ze(e,t){return B(t,"skills","extractSkillsFromDetails",async()=>(await O(e,t,"skills"),await e.evaluate(`(() => {
83
+ ${N}
84
+
85
+ const main = document.querySelector('main');
86
+ if (!main) return [];
87
+ const container = findEntryContainer(main);
88
+ if (!container) return [];
89
+
90
+ const entries = Array.from(container.children)
91
+ .filter(c => c.tagName === 'DIV')
92
+ .filter(c => (c.textContent || '').trim().length > 1);
93
+
94
+ const seen = new Set();
95
+ const skills = [];
96
+ for (const entry of entries) {
97
+ const raw = (entry.innerText || '').trim();
98
+ const lines = raw.split('\\n').map(l => l.trim()).filter(Boolean);
99
+ if (lines.length === 0) continue;
100
+
101
+ const name = lines[0];
102
+ if (!name || name.length > 100 || seen.has(name.toLowerCase())) continue;
103
+ seen.add(name.toLowerCase());
104
+
105
+ let endorsements = null;
106
+ for (const l of lines.slice(1)) {
107
+ const m = l.match(/(\\d+)\\s+endorsement/i);
108
+ if (m) { endorsements = parseInt(m[1], 10); break; }
109
+ }
110
+
111
+ skills.push({ name, endorsements, _raw: lines });
112
+ }
113
+ return skills;
114
+ })()`)))}async function Qe(e,t){return B(t,"certifications","extractCertificationsFromDetails",async()=>(await O(e,t,"certifications"),await e.evaluate(`(() => {
115
+ ${N}
116
+
117
+ const main = document.querySelector('main');
118
+ if (!main) return [];
119
+ const container = findEntryContainer(main);
120
+ if (!container) return [];
121
+
122
+ const entries = Array.from(container.children)
123
+ .filter(c => c.tagName === 'DIV')
124
+ .filter(c => (c.textContent || '').trim().length > 20);
125
+
126
+ return entries.map(entry => {
127
+ const raw = (entry.innerText || '').trim();
128
+ const lines = raw.split('\\n').map(l => l.trim()).filter(l => l && l.length < 2000);
129
+
130
+ const name = lines[0] || null;
131
+ const issuer = lines[1] || null;
132
+ const issueDate = lines.find(l => /^Issued\\b/i.test(l)) || null;
133
+ const expiryDate = lines.find(l => /Expir(es|ed)\\b/i.test(l)) || null;
134
+ const credentialId = (lines.find(l => /credential id/i.test(l)) || '')
135
+ .replace(/^.*credential id[:\\s]*/i, '').trim() || null;
136
+
137
+ return { name, issuer, issueDate, expiryDate, credentialId, _raw: lines };
138
+ }).filter(e => e.name);
139
+ })()`)))}async function Ze(e,t){return B(t,"recommendations","extractRecommendationsFromDetails",async()=>(await O(e,t,"recommendations"),await e.evaluate(`(() => {
140
+ ${N}
141
+
142
+ const main = document.querySelector('main');
143
+ if (!main) return [];
144
+ const container = findEntryContainer(main);
145
+ if (!container) return [];
146
+
147
+ const entries = Array.from(container.children)
148
+ .filter(c => c.tagName === 'DIV')
149
+ .filter(c => (c.textContent || '').trim().length > 50);
150
+
151
+ return entries.map(entry => {
152
+ const raw = (entry.innerText || '').trim();
153
+ const lines = raw.split('\\n').map(l => l.trim()).filter(l => l && l.length < 5000);
154
+
155
+ const recommender = lines[0] || null;
156
+ const recommenderTitle = lines[1] || null;
157
+ const relationship = lines.find(l =>
158
+ /\\b(was |worked |reported |managed |taught |studied )\\b/i.test(l) &&
159
+ l.length < 200
160
+ ) || null;
161
+ const date = lines.find(l => /(January|February|March|April|May|June|July|August|September|October|November|December)\\s+\\d{1,2}.*\\d{4}/i.test(l)) || null;
162
+ // Recommendation text is the longest non-meta line
163
+ const text = [...lines].sort((a, b) => b.length - a.length)[0] || '';
164
+
165
+ return { recommender, recommenderTitle, relationship, date, text, _raw: lines };
166
+ }).filter(e => {
167
+ if (!e.recommender || !e.text) return false;
168
+ // Reject "People You May Know" sidebar cards: [title, "View"].
169
+ if (e._raw.length === 2 && e._raw[1] === 'View') return false;
170
+ // Reject related-profile widget: recommenderTitle is the
171
+ // connection-degree marker, not a real job title.
172
+ if (e.recommenderTitle && /^\xB7\\s*\\d+(?:st|nd|rd|th)\\+?$/i.test(e.recommenderTitle.trim())) return false;
173
+ return true;
174
+ });
175
+ })()`)))}var N,ye=de(()=>{j();N=`
176
+ function findEntryContainer(root) {
177
+ const candidates = [];
178
+ for (const div of root.querySelectorAll('div')) {
179
+ const directDivs = Array.from(div.children).filter(c => c.tagName === 'DIV');
180
+ if (directDivs.length < 2) continue;
181
+ const substantial = directDivs.filter(c => (c.textContent || '').trim().length > 30);
182
+ if (substantial.length < 2) continue;
183
+ if ((div.textContent || '').length < 200) continue;
184
+
185
+ // Reject "People You May Know" suggestion containers: every substantial
186
+ // child is exactly [title, "View"] (a tiny suggestion card with a single
187
+ // "View" CTA). Real section entries always have richer per-child content
188
+ // (multiple text lines per entry).
189
+ const allLookLikePYMK = substantial.every(c => {
190
+ const lines = (c.innerText || '').trim().split('\\n').map(l => l.trim()).filter(Boolean);
191
+ return lines.length === 2 && lines[1] === 'View';
192
+ });
193
+ if (allLookLikePYMK) continue;
194
+
195
+ // Reject "Other profiles you may know" / related-profile widget:
196
+ // LinkedIn shows this when /details/<section>/ has no real data
197
+ // (e.g. profile has no Featured at all). Every entry is a short
198
+ // [name, "\xB7 Nth"] card with a connection-degree marker as the only
199
+ // metadata. Real Featured / Education / Recommendations entries
200
+ // NEVER consist solely of name + degree.
201
+ const DEGREE_RE = /^\xB7\\s*\\d+(?:st|nd|rd|th)\\+?$/i;
202
+ const allLookLikeRelatedProfiles = substantial.every(c => {
203
+ const lines = (c.innerText || '').trim().split('\\n').map(l => l.trim()).filter(Boolean);
204
+ if (lines.length > 4) return false;
205
+ return lines.some(l => DEGREE_RE.test(l));
206
+ });
207
+ if (allLookLikeRelatedProfiles) continue;
208
+
209
+ // Reject LinkedIn footer/legal blocks: when a /details/<section>/ page
210
+ // renders empty, LinkedIn falls back to "Questions? Visit our Help
211
+ // Center", "Select language" (35+ languages), "Recommendation
212
+ // transparency" and similar nav cards inside <main>. These are unique
213
+ // marker strings that never appear inside real section entries.
214
+ const containerText = div.textContent || '';
215
+ const FOOTER_MARKERS = [
216
+ 'Visit our Help Center',
217
+ 'Select language',
218
+ 'Recommendation transparency',
219
+ 'Manage your account and privacy',
220
+ 'Go to your Settings',
221
+ 'Who your viewers also viewed', // "Private to you" PYMK block on empty pages
222
+ 'People also viewed',
223
+ 'People you may know',
224
+ 'More profiles for you', // LinkedIn related-profiles widget shown
225
+ 'Other profiles you may know', // when /details/<section>/ is empty
226
+ ];
227
+ if (FOOTER_MARKERS.some(m => containerText.includes(m))) continue;
228
+
229
+ candidates.push({ el: div, count: substantial.length, totalText: (div.textContent || '').length });
230
+ }
231
+ // Sort: most children first, then RICHER children (larger totalText) \u2014 real
232
+ // section entries dominate via content density, not just child count. The
233
+ // previous "smaller totalText wins" tie-break gave PYMK sidebars priority
234
+ // over the real Education / Recommendations lists.
235
+ candidates.sort((a, b) => b.count - a.count || b.totalText - a.totalText);
236
+ return candidates[0]?.el;
237
+ }
238
+ `});import je from"puppeteer";import{addExtra as Oe}from"puppeteer-extra";import Ne from"puppeteer-extra-plugin-stealth";j();import{getPluginConfig as Te}from"@ilivemylife/graph-sdk";var Me=await Te();for(let[e,t]of Object.entries(Me))process.env[e]===void 0&&(process.env[e]=t);var Le=process.env.LINKEDIN_NAME,F=Object.freeze({DRAFT:"draft",CONFIRMED:"confirmed",REJECTED:"rejected",NEEDS_REVIEW:"needs_review",SENT:"sent"}),lt=Object.freeze(new Set([F.DRAFT,F.CONFIRMED,F.NEEDS_REVIEW])),Fe=Object.freeze(new Set([F.DRAFT,F.CONFIRMED,F.REJECTED,F.NEEDS_REVIEW]));import fe from"fs";import qe from"path";var Pe="cookies.json";function Re(){let e=process.env.ILML_SCOPE_DIR;return e?qe.join(e,"plugins-state","linkedin","cookies.json"):Pe}function pe(){let e=Re();if(!fe.existsSync(e))throw new Error(`Cookies not found at ${e}. Run: ilml linkedin login`);let t;try{t=fe.readFileSync(e,"utf-8")}catch(n){throw new Error(`Failed to read cookies at ${e}: ${n.message}. Run: ilml linkedin login`)}let o;try{o=JSON.parse(t)}catch{throw new Error(`Cookies file at ${e} is corrupted (invalid JSON). Run: ilml linkedin login`)}if(!Array.isArray(o)||o.length===0)throw new Error(`Cookies file at ${e} is empty or not an array. Run: ilml linkedin login`);return o}var he=Oe(je);he.use(Ne());async function ge(){let e=await he.launch({headless:!1,defaultViewport:null,protocolTimeout:3e5}),t=async()=>{console.log(`
239
+ Closing browser...`);try{await e.close()}catch{}process.exit(0)};process.on("SIGINT",t),process.on("SIGTERM",t);let o=await e.newPage();await o.evaluateOnNewDocument(()=>{Object.defineProperty(navigator,"webdriver",{get:()=>{}})});try{let n=pe();await o.setCookie(...n),console.log(" Browser launched, cookies loaded.")}catch(n){console.error(`
240
+ [!] ${n.message}
241
+ `),await e.close(),process.exit(1)}return{browser:e,page:o}}j();import"dotenv/config";import*as g from"fs";import*as b from"path";import{fileURLToPath as Be}from"url";var He=Be(import.meta.url),Ue=b.dirname(b.dirname(He)),A=process.env.DATA_DIR?b.resolve(process.env.DATA_DIR,"collected-profiles"):b.join(Ue,"collected-profiles"),Ve=b.join(A,"people.json"),_t=b.join(A,"jobs.json"),Et=b.join(A,"quota.json"),At=b.join(A,"conversations.json"),$t=b.join(A,"sync-state.json"),It=b.join(A,"application-questions.json"),Dt=b.join(A,"profile-history");var W=null;function We(){g.existsSync(A)||g.mkdirSync(A,{recursive:!0})}function Je(e,t){if(!g.existsSync(e))return null;try{let o=JSON.parse(g.readFileSync(e,"utf-8"));try{g.copyFileSync(e,e+".backup")}catch{}return o}catch(o){console.error(`[!] ${t} is corrupted: ${o.message}`),console.error(` File: ${b.resolve(e)}`);let n=e+".backup";if(g.existsSync(n))try{let s=JSON.parse(g.readFileSync(n,"utf-8"));console.error(` Restored from ${n}`);try{g.copyFileSync(n,e)}catch{}return s}catch{console.error(" Backup also corrupted!")}console.error(` Starting with empty data. Old file preserved as ${e}.corrupted`);try{g.copyFileSync(e,e+".corrupted")}catch{}return null}}function z(){return W||(We(),W=Je(Ve,"people.json")||{},W)}async function Xe(e,t){let o=e.url();if(o.includes("/in/"))return!1;if(o.includes("/login")||o.includes("/authwall")||o.includes("/checkpoint"))throw new Error("Session expired \u2014 redirected to login. Run: npm run login");console.log(` Off-track: ${o.slice(0,80)}`),console.log(" Navigating back to profile..."),await e.goto(t,{waitUntil:"domcontentloaded",timeout:6e4}),await d(3e3);let n=e.url();return n.includes("/in/")||console.log(` Recovery failed \u2014 still on: ${n.slice(0,80)}`),!0}async function be(e,t,o={}){let{extractExperience:n=!1,extractFeatured:s=!1,extractEducation:m=!1,extractSkills:u=!1,extractRecommendations:h=!1,extractCertifications:D=!1}=o;try{await e.goto(t,{waitUntil:"domcontentloaded",timeout:6e4}),await d(3e3),await me(e)&&(console.log(" Dismissed Premium overlay"),await d(1500),await Xe(e,t));let l=0;for(let y=0;y<2;y++){let q=await e.evaluate(()=>document.body.scrollHeight);for(let L=1;L<=6;L++)await e.evaluate(k=>window.scrollTo(0,k),q*L/6),await d(900);let E=await e.evaluate(()=>document.body.scrollHeight);if(E===l)break;l=E}await d(800);let S=await e.evaluate(()=>{let y=new Set(["Highlights","About","Activity","Experience","Education","Skills","Recommendations","Languages","Interests","Volunteer experience","Featured","Honors & awards","Honors and awards","Projects","Publications","Patents","Certifications","Licenses & certifications","Courses","Test scores","Organizations"]),q=new Set(["Ad Options","Don\u2019t want to see this","0 notifications","Explore Premium profiles","You might like","People you may know","Suggested for you","More profiles for you","Promoted"]),E=i=>{let r=(i||"").trim().replace(/^[·•]\s*/,"");return/^(1st|2nd|3rd|she\/her|he\/him|they\/them|their\/them)$/i.test(r)},L={name:null,title:null,location:null,currentCompany:null,currentSchool:null,connectionDegree:null,hasVerifiedBadge:!1,photoUrl:null,connectionsLevel:null,mutualConnectionsCount:null,followers:null,openToWork:!1,hiring:!1,about:null,topSkills:null,availableSections:[]},k=document.querySelector("main");if(!k)return L;let Y=[...Array.from(k.querySelectorAll("h1")),...Array.from(k.querySelectorAll("h2"))],a=Array.from(k.querySelectorAll("h2")),C=Y.find(i=>{let r=i.textContent&&i.textContent.trim(),c=(r||"").replace(/\s*\(\d+\)$/,"").trim();return r&&r.length>1&&r.length<100&&!y.has(c)&&!q.has(c)}),P=C?C.textContent.trim():null,v=C?C.parentElement:null;for(;v&&v!==k&&!Array.from(v.children).filter(r=>r.tagName==="P").some(r=>{let c=r.textContent&&r.textContent.trim();return c&&c.length>5&&!E(c)});)v=v.parentElement;let H=null,Z=null,X=null,K=null;if(v&&v!==k){let i=Array.from(v.children).filter(c=>c.tagName==="P").filter(c=>{let I=c.textContent&&c.textContent.trim();return I&&I.length>5&&!E(I)});if(i[0]&&(H=i[0].textContent.trim()),i[1]){let c=i[1].textContent.trim().split(/\s*[·•]\s*/);Z=c[0]||null,c.length>1&&(X=c.slice(1).join(" \xB7 "))}let r=Array.from(v.children).filter(c=>c.tagName==="DIV");for(let c=r.length-1;c>=0;c--){let I=r[c].textContent&&r[c].textContent.trim();if(I&&!(P&&I.startsWith(P))&&(K=I.split(/[·•]/)[0].trim(),K))break}}let ee=null;if(v){let i=v.querySelectorAll("p, span, div");for(let r of i){let c=(r.textContent||"").trim().replace(/^[·•]\s*/,"");if(c==="1st"||c==="2nd"||c==="3rd"){ee=c;break}}}let ke=!!k.querySelector('svg[data-test-icon="verified"], [aria-label*="Verified" i]'),te=document.querySelector('main img[width="200"], button img[alt*="photo" i]'),ve=te&&te.src||null,U=k.textContent||"",ne=null,oe=U.match(/(\d+\+?)\s+connections\b/i);oe&&(ne=oe[1]+" connections");let V=null,ie=U.match(/(\d+)\s+mutual connection/i),se=U.match(/and\s+(\d+)\s+other mutual/i),xe=U.match(/([A-Z][\w'-]+(?:\s+[A-Z][\w'-]+)?)\s+and\s+([A-Z][\w'-]+(?:\s+[A-Z][\w'-]+)?)\s+are\s+mutual/);ie?V=parseInt(ie[1],10):se?V=2+parseInt(se[1],10):xe&&(V=2);let re=null,le=null,ae=a.find(i=>i.textContent&&i.textContent.trim()==="About");if(ae){let i=ae.parentElement;for(;i&&i.tagName!=="SECTION";)i=i.parentElement;if(i){let r=(i.textContent||"").trim();r=r.replace(/^About\s*/,"").trim();let c=r.match(/Top skills\s*(.+?)$/i);if(c){let G=c[1].split(/\b(?:see (?:more|less)|show (?:more|less))\b/i)[0].trim().split(/\s*[·•]\s*/).map($e=>$e.trim()).filter(Boolean);G.length>0&&G.length<10&&(le=G)}r=r.split(/\n?…\s*more/i)[0].trim(),r=r.split(/\n?\.\.\.\s*more/i)[0].trim(),r=r.split(/\bTop skills\b/i)[0].trim(),r=r.split(/\b(?:see (?:more|less)|show (?:more|less))\b/i)[0].trim(),re=r||null}}let ce=null,ue=a.find(i=>i.textContent&&i.textContent.trim()==="Activity");if(ue){let i=ue.parentElement;for(;i&&i.tagName!=="SECTION";)i=i.parentElement;if(i){let r=(i.textContent||"").slice(0,200).match(/([\d,]+)\s+followers/i);r&&(ce=parseInt(r[1].replace(/,/g,""),10))}}let _e=[...new Set(a.map(i=>(i.textContent||"").trim().replace(/\s*\(\d+\)$/,"").trim()).filter(i=>i&&i.length>1&&i.length<60&&i!==P).filter(i=>y.has(i)))],R=document.body.textContent||"",Ee=/#OpenToWork\b/i.test(R)||/\bOpen to work\b/.test(R),Ae=/#Hiring\b/i.test(R)||/\bI'?m hiring\b/i.test(R)||/\bWe are hiring\b/i.test(R);return{name:P,title:H,location:K,currentCompany:Z,currentSchool:X,connectionDegree:ee,hasVerifiedBadge:ke,photoUrl:ve,connectionsLevel:ne,mutualConnectionsCount:V,followers:ce,openToWork:Ee,hiring:Ae,about:re,topSkills:le,availableSections:_e}});console.log(`Viewed: ${S.name} - ${S.title}`);let f=null,p=null,w=null,x=null,T=null,M=null;if(n||s||m||u||h||D){let y=await Promise.resolve().then(()=>(ye(),we));n&&(f=await y.extractExperienceFromDetails(e,t),console.log(` + Experience: ${f.length} entries`)),s&&(p=await y.extractFeaturedFromDetails(e,t),console.log(` + Featured: ${p.length} entries`)),m&&(w=await y.extractEducationFromDetails(e,t),console.log(` + Education: ${w.length} entries`)),u&&(x=await y.extractSkillsFromDetails(e,t),console.log(` + Skills: ${x.length} entries`)),h&&(T=await y.extractRecommendationsFromDetails(e,t),console.log(` + Recommendations: ${T.length} entries`)),D&&(M=await y.extractCertificationsFromDetails(e,t),console.log(` + Certifications: ${M.length} entries`))}return{...S,profileUrl:t,...f!==null&&{experience:f},...p!==null&&{featured:p},...w!==null&&{education:w},...x!==null&&{skillsFull:x},...T!==null&&{recommendations:T},...M!==null&&{certifications:M}}}catch($){console.error(`Error viewing profile ${t}:`,$.message);try{await e.goto("about:blank",{timeout:1e4}),await d(1e3)}catch{}if(/session expired|bounced to|authwall|checkpoint|redirected to login/i.test($.message||""))throw $;return null}}j();var Q=process.argv.slice(2),Se=Q.filter(e=>e.startsWith("http")),Ce=parseInt(Q.find(e=>e.startsWith("--pick="))?.split("=")[1]||"0"),et=Q.includes("--has-about");function tt(e,t){return[...e].sort(()=>Math.random()-.5).slice(0,t)}function nt(){if(Se.length>0)return Se.map(t=>({url:t,name:"(arg)"}));if(Ce>0){let t=z(),o=Object.entries(t).filter(([n])=>n.startsWith("http")).filter(([,n])=>et?!!(n.about&&n.about.trim()):!n.about);return tt(o,Ce).map(([n,s])=>({url:n,name:s.name}))}let e=process.env.MY_LINKEDIN_URL;return e||(console.error("Pass a URL, use --pick=N, or set MY_LINKEDIN_URL in .env"),process.exit(1)),[{url:e,name:"(self)"}]}function _(e,t,o=80){if(t==null){console.log(` ${e.padEnd(20)} (null)`);return}let n=String(t),s=n.length>o?n.slice(0,o)+`\u2026 (+${n.length-o} chars)`:n;console.log(` ${e.padEnd(20)} ${s} [len=${n.length}]`)}async function ot(){let e=nt();console.log(`
8
242
  About-selector verification \u2014 ${e.length} profile(s)
9
- `);let{browser:n,page:s}=await se();try{for(let t=0;t<e.length;t++){let{url:l,name:y}=e[t];console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"),console.log(` [${t+1}/${e.length}] ${y}`),console.log(` ${l}`),console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");let u=await le(s,l);if(!u){console.log(` \u26A0 viewProfile returned null \u2014 selector failed entirely
10
- `);continue}x("name",u.name),x("title",u.title),x("location",u.location),x("company",u.company),x("connectionDegree",u.connectionDegree),x("connectionsCount",u.connectionsCount),x("mutualConnections",u.mutualConnections),x("hasVerifiedBadge",u.hasVerifiedBadge),x("photoUrl",u.photoUrl,60),console.log(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 about \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),x("about",u.about,200);let f=[];u.name||f.push("NAME MISSING"),u.title||f.push("TITLE MISSING"),u.location||f.push("LOCATION MISSING"),u.about||f.push("ABOUT MISSING"),console.log(`
11
- Verdict: ${f.length===0?"OK \u2014 all core fields present":f.join(", ")}
12
- `),t<e.length-1&&await p(3e3+Math.random()*2e3)}}finally{await n.close().catch(()=>{})}}Oe().catch(e=>{console.error("verify-about failed:",e),process.exit(1)});
243
+ `);let{browser:t,page:o}=await ge();try{for(let n=0;n<e.length;n++){let{url:s,name:m}=e[n];console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"),console.log(` [${n+1}/${e.length}] ${m}`),console.log(` ${s}`),console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");let u=await be(o,s);if(!u){console.log(` \u26A0 viewProfile returned null \u2014 selector failed entirely
244
+ `);continue}_("name",u.name),_("title",u.title),_("location",u.location),_("company",u.company),_("connectionDegree",u.connectionDegree),_("connectionsCount",u.connectionsCount),_("mutualConnections",u.mutualConnections),_("hasVerifiedBadge",u.hasVerifiedBadge),_("photoUrl",u.photoUrl,60),console.log(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 about \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),_("about",u.about,200);let h=[];u.name||h.push("NAME MISSING"),u.title||h.push("TITLE MISSING"),u.location||h.push("LOCATION MISSING"),u.about||h.push("ABOUT MISSING"),console.log(`
245
+ Verdict: ${h.length===0?"OK \u2014 all core fields present":h.join(", ")}
246
+ `),n<e.length-1&&await d(3e3+Math.random()*2e3)}}finally{await t.close().catch(()=>{})}}ot().catch(e=>{console.error("verify-about failed:",e),process.exit(1)});