ilml-plugin-linkedin 1.20.2 → 1.20.4
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/CHANGELOG.md +10 -0
- package/dist/connect.mjs +51 -51
- package/dist/enrichProfile.mjs +10 -10
- package/dist/enrichProfiles.mjs +34 -35
- package/dist/funnelRunner.mjs +38 -38
- package/dist/messageBot.mjs +74 -75
- package/dist/readPost.mjs +10 -10
- package/dist/run.mjs +58 -59
- package/dist/scout.mjs +38 -39
- package/dist/src/saveLoginState.mjs +4 -4
- package/dist/syncAll.mjs +79 -80
- package/dist/syncConnections.mjs +30 -31
- package/dist/verifyAbout.mjs +18 -19
- package/dist/version.mjs +1 -1
- package/dist/viewers.mjs +20 -21
- package/dist/visit.mjs +36 -37
- package/ilml-plugin.json +1 -1
- package/package.json +1 -1
package/dist/readPost.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _e=Object.defineProperty;var ve=(e,o)=>()=>(e&&(o=e(e=0)),o);var Te=(e,o)=>{for(var t in o)_e(e,t,{get:o[t],enumerable:!0})};var ge={};Te(ge,{graph:()=>Me});import{createGraphClient as Ne,resolveToken as Re}from"@ilivemylife/graph-sdk";import{config as Ue}from"dotenv";var he,Me,ye=ve(()=>{Ue();he=Re()||process.env.TOKEN;he||(console.error(`
|
|
2
2
|
[FATAL] No iLiveMyLife token found.`),console.error(" The bot uses Lifebot AI to decide which jobs to apply for"),console.error(` and how to fill application forms. It cannot work without it.
|
|
3
3
|
`),console.error(" Easiest way:"),console.error(" 1. npm install -g @ilivemylife/graph-sdk"),console.error(` 2. ilml login your@email.com yourpassword
|
|
4
4
|
`),console.error(` Or add ILML_TOKEN=... to .env
|
|
5
|
-
`),process.exit(1));
|
|
5
|
+
`),process.exit(1));Me=Ne({token:he})});import"dotenv/config";import je from"puppeteer";var G=e=>new Promise(o=>setTimeout(o,e));function X(e){return e?e.split("?")[0].split("#")[0]:""}async function z(e,o,t={}){let a=t.commentPasses??4,f=t.skipComments??!1,i=Number.isFinite(t.commentsMax)?t.commentsMax:1/0;if(await e.goto(o,{waitUntil:"domcontentloaded",timeout:6e4}),await G(4e3),await e.evaluate(()=>/\/login|\/authwall|\/checkpoint|\/uas\//.test(location.pathname)||!!document.querySelector('input[name="session_key"]')))return{authWall:!0};let x=f?2:6;for(let s=0;s<x;s++)await e.evaluate(()=>window.scrollBy(0,1200)),await G(f?500:1e3);if(f)await e.evaluate(()=>{for(let s of document.querySelectorAll("button")){let d=`${s.innerText||""} ${s.getAttribute("aria-label")||""}`;if(/^(see more|…more|show more)$/i.test(d.trim()))try{s.click()}catch{}}}),await G(500);else for(let s=0;s<a;s++){let d=await e.evaluate(()=>{let c=0;for(let m of document.querySelectorAll("button")){let y=`${m.innerText||""} ${m.getAttribute("aria-label")||""}`;if(/see more|…more|show more|load more comments|more comments|previous replies|more replies|показать ещё|ещё|загрузить ещё|показать предыдущие/i.test(y))try{m.click(),c++}catch{}}return c});if(await G(1800),!d)break}let n=await e.evaluate(()=>{let s=(h,g)=>{for(let T of g){let S=h&&h.querySelector(T);if(S&&(S.innerText||"").trim())return S.innerText.trim()}return""},d=(h,g)=>{for(let T of g){let S=h&&h.querySelector(T);if(S&&S.href)return S.href}return""},c=document.querySelector("main")||document.body,m=document.querySelector(".fie-impression-container")||document.querySelector(".feed-shared-update-v2")||c,y={name:s(m,['.update-components-actor__title span[aria-hidden="true"]','.update-components-actor__name span[aria-hidden="true"]',".update-components-actor__title",".update-components-actor__name"]),profileUrl:d(m,['.update-components-actor__container a[href*="/in/"]','.update-components-actor__meta a[href*="/in/"]','a.app-aware-link[href*="/in/"]']),headline:s(m,[".update-components-actor__description"])},C=s(m,[".update-components-update-v2__commentary",".feed-shared-update-v2__description",".update-components-text"]),U=s(m,['.update-components-actor__sub-description span[aria-hidden="true"]',".update-components-actor__sub-description"]),M=s(document,[".social-details-social-counts__reactions-count",".social-details-social-counts__social-proof-fallback-number"]),j=s(document,['button[aria-label*="comment" i] span',".social-details-social-counts__comments"]),v=s(document,['button[aria-label*="repost" i] span',".social-details-social-counts__reposts",".social-details-social-counts__shares"]),u=m.querySelector(".update-components-update-v2__commentary")||m.querySelector(".update-components-text")||m,E=Array.from(u?.querySelectorAll?.('a[href*="/in/"], a[href*="/company/"]')||[]),I=[],F=new Set;for(let h of E){let g=(h.href||"").split("?")[0].replace(/\/$/,"");if(!g||F.has(g))continue;F.add(g);let T=(h.textContent||"").trim(),S=g.includes("/company/")?"company":"person";I.push({kind:S,url:g,label:T||null})}let D=Array.from(new Set(((C||"")+" "+(u?.textContent||"")).match(/#[\p{L}\p{N}_]{2,40}/gu)||[])),B={hasImage:!!m.querySelector(".update-components-image, img.feed-shared-image__image"),hasVideo:!!m.querySelector("video, .update-components-video, .feed-shared-update-v2__content video"),hasArticle:!!m.querySelector(".update-components-article, .feed-shared-article"),hasDocument:!!m.querySelector(".feed-shared-document, .update-components-document"),hasPoll:!!m.querySelector(".update-components-poll, .feed-shared-poll")},q=document.querySelectorAll("article.comments-comment-entity, .comments-comment-entity, .comments-comment-item"),l=[];for(let h of q){let g=s(h,[".comments-comment-meta__description-title",'.comments-post-meta__name-text span[aria-hidden="true"]',".comments-post-meta__name-text"]),T=s(h,[".comments-comment-item__main-content",".comments-comment-entity__content .update-components-text",".comments-comment-entity__content",".update-components-text"]);!g&&!T||l.push({author:{name:g,profileUrl:d(h,['a[href*="/in/"]']),headline:s(h,[".comments-comment-meta__description-subtitle",".comments-post-meta__headline"])},text:T})}let H=new Set,Se=l.filter(h=>{let g=`${h.author.name}|${h.text.slice(0,80)}`;return H.has(g)?!1:(H.add(g),!0)});return{url:location.href,author:y,text:C,postedAt:U,reactions:M,commentCount:j,repostCount:v,hashtags:D,mentions:I,media:B,comments:Se,fullText:(c.innerText||"").replace(/\n{3,}/g,`
|
|
6
6
|
|
|
7
|
-
`)}});
|
|
8
|
-
`).map(
|
|
7
|
+
`)}});f?(n.comments=[],n.commentsTruncated=!0,n.commentsTruncatedReason="skipComments"):Number.isFinite(i)&&n.comments.length>i?(n.commentsTruncated=!0,n.commentsTruncatedReason=`commentsMax=${i}`,n.commentsTruncatedOriginalCount=n.comments.length,n.comments=n.comments.slice(0,i)):n.commentsTruncated=!1,n.author.profileUrl=X(n.author.profileUrl),n.comments=n.comments.map(s=>({...s,author:{...s.author,profileUrl:X(s.author.profileUrl)}}));let w=n.fullText||"";if(!n.author.name){let s=w.match(/\n\s*Feed post\s*\n+\s*([^\n]+)/i);s&&(n.author.name=s[1].trim())}if(!n.reactions){let s=w.match(/([\d,]+)\s+reactions?/i);s&&(n.reactions=s[1])}if(!n.commentCount){let s=w.match(/([\d,]+)\s+comments?/i);s&&(n.commentCount=s[1])}let r=w,P=r.search(/\n\s*Feed post\s*\n/i);if(P>=0&&(r=r.slice(P).replace(/^\s*Feed post\s*\n/i,"")),r=r.replace(/\n\s*About\s*\n+\s*Accessibility[\s\S]*$/i,"").replace(/\n\s*LinkedIn Corporation ©[\s\S]*$/i,"").trim(),n.cleanText=r,n.cleanText){let s=n.cleanText.split(`
|
|
8
|
+
`).map(c=>c.trim()),d=s.findIndex(c=>/^\d+\s*[mhdwy]\s*•/i.test(c));if(d>=0&&(n.postedAt||(n.postedAt=s[d].replace(/\s*•\s*$/,"").trim()),!n.text)){let c=[];for(let m=d+1;m<s.length;m++){let y=s[m];if(/^(Most relevant|Top comments|Comments|All comments|\d+ comments?)\b/i.test(y)||/^[\d,]+$/.test(y)&&/^[\d,]+$/.test(s[m+1]||""))break;c.push(y)}n.text=c.join(`
|
|
9
9
|
`).replace(/\n{3,}/g,`
|
|
10
10
|
|
|
11
|
-
`).trim()}}if(!
|
|
12
|
-
`).map(
|
|
13
|
-
`).trim();
|
|
11
|
+
`).trim()}}if(!f&&n.comments.length===0&&n.cleanText){let s=n.cleanText.split(`
|
|
12
|
+
`).map(c=>c.trim()),d=s.findIndex(c=>/^(Most relevant|Top comments|Recent comments)$/i.test(c));if(d>=0){let c=s.slice(d+1),m=[],y=[];for(let u of c){if(/^\d+\s+reactions?/i.test(u)){y.length>0&&m.push(y),y=[];continue}y.push(u)}y.length>0&&m.push(y);let C=u=>/Premium Profile|Verified Profile/i.test(u),U=u=>/[·•]\s*\d+(?:st|nd|rd|th)\+?/i.test(u),M=u=>/^\d+$/.test(u),j=u=>/^(Reactions|Reply|Like|Author|See translation|Show \d+)$/i.test(u),v=[];for(let u of m){let E=u.findIndex(l=>l==="Follow");if(E<0)continue;let I=(u.find(l=>l&&!C(l)&&!U(l)&&!M(l)&&!j(l))||"").trim(),F=u.find(l=>/^\d+[hmsdwy]$/.test(l))||"",D=u.slice(0,E).filter(l=>l&&l!==I&&l!==F&&!C(l)&&!U(l)&&!M(l)&&!j(l));D.sort((l,H)=>H.length-l.length);let B=D[0]||"",q=u.slice(E+1).filter(l=>l&&l!=="Reply"&&l!=="Like"&&l!=="Reactions").join(`
|
|
13
|
+
`).trim();I&&q&&v.push({author:{name:I,headline:B,profileUrl:""},text:q})}if(v.length>0){let u=Number.isFinite(i)?v.slice(0,i):v;n.comments=u,n.commentsFromCleanTextFallback=!0,u.length<v.length&&(n.commentsTruncated=!0,n.commentsTruncatedReason=`commentsMax=${i}`,n.commentsTruncatedOriginalCount=v.length)}}}if(n.text&&Array.isArray(n.mentions)&&n.mentions.length>0){let s=n.text.toLowerCase(),d=n.mentions.filter(c=>c.label?s.includes(c.label.toLowerCase()):!1);n.mentionsFilteredFromDOM=n.mentions.length-d.length,n.mentions=d}let R=o.match(/(?:activity-|share-)(\d{6,})/);return n.urn=R?R[1]:"",n}import k from"fs";import $ from"path";var $e="cookies.json";function Z(){let e=process.env.ILML_SCOPE_DIR;return e?$.join(e,"plugins-state","linkedin","cookies.json"):$e}function Q(){let e=Z();if(!k.existsSync(e))throw new Error(`Cookies not found at ${e}. Run: ilml linkedin login`);let o;try{o=k.readFileSync(e,"utf-8")}catch(a){throw new Error(`Failed to read cookies at ${e}: ${a.message}. Run: ilml linkedin login`)}let t;try{t=JSON.parse(o)}catch{throw new Error(`Cookies file at ${e} is corrupted (invalid JSON). Run: ilml linkedin login`)}if(!Array.isArray(t)||t.length===0)throw new Error(`Cookies file at ${e} is empty or not an array. Run: ilml linkedin login`);return t}function ee(){return k.existsSync(Z())}function Ae(){let e=process.env.ILML_SCOPE_DIR;return e?$.join(e,"plugins-state","linkedin"):"."}function te(e){let o=String(e||"").replace(/[^a-zA-Z0-9_.-]/g,"_").slice(0,80);return/[a-zA-Z0-9]/.test(o)?o:"default"}function be(){let e=process.env.MY_LINKEDIN_URL,o=e&&e.match(/\/in\/([^/?#]+)/);return o&&o[1]?te(o[1]):"default"}function oe(e){let o=process.env.LINKEDIN_CHROME_PROFILE_DIR;if(o)return k.existsSync(o)||k.mkdirSync(o,{recursive:!0}),$.resolve(o);let t=te(e||be()),a=$.join(Ae(),"chrome-profile",t);return k.existsSync(a)||k.mkdirSync(a,{recursive:!0}),$.resolve(a)}var ne=".ilml-seeded";function se(e){return!k.existsSync($.join(e,ne))}function ie(e){try{k.writeFileSync($.join(e,ne),new Date().toISOString())}catch{}}function re(e){let o=0;for(let t of["SingletonLock","SingletonCookie","SingletonSocket"])try{k.rmSync($.join(e,t),{force:!0}),o++}catch{}return o}import K from"fs";import Ie from"path";var Pe={headless:!1,defaultViewport:null,protocolTimeout:3e5},O=new Set,ce=!1;async function W(){let e=[...O].map(o=>{try{return Promise.resolve(o.close()).catch(()=>{})}catch{return Promise.resolve()}});O.clear(),await Promise.race([Promise.all(e),new Promise(o=>setTimeout(o,5e3))])}function Ce(){if(ce)return;ce=!0;let e=o=>async()=>{await W(),process.exit(o)};process.once("SIGINT",e(130)),process.once("SIGTERM",e(143)),process.once("SIGHUP",e(129)),process.once("uncaughtException",async o=>{await W(),console.error(o&&o.stack||o),process.exit(1)}),process.once("unhandledRejection",async o=>{await W(),console.error(o),process.exit(1)}),process.stdout.on("error",async o=>{o&&o.code==="EPIPE"&&(await W(),process.exit(0))}),process.on("exit",()=>{for(let o of O)try{let t=o.process&&o.process();t&&t.kill("SIGKILL")}catch{}})}function V(e){return Ie.join(e,".ilml-browser-session.json")}function ue(e,o={}){try{K.writeFileSync(V(e),JSON.stringify({ownerPid:process.pid,startedAt:Date.now(),...o}))}catch{}}function Ee(e,o){try{let t=o.wsEndpoint&&o.wsEndpoint();ue(e,t?{wsEndpoint:t}:{})}catch{}}function Le(e){let o=de(e);o&&o.ownerPid===process.pid&&L(e)}function L(e){try{K.rmSync(V(e),{force:!0})}catch{}}function de(e){try{return JSON.parse(K.readFileSync(V(e),"utf-8"))}catch{return null}}function ae(e){if(!e||e===process.pid)return!0;try{return process.kill(e,0),!0}catch(o){return!o||o.code!=="ESRCH"}}function le(e,o,t){let a,f=new Promise(p=>{a=setTimeout(()=>p(t),o)}),i=Promise.resolve(e).then(p=>(clearTimeout(a),p),p=>{throw clearTimeout(a),p});return Promise.race([i,f])}async function me(e,o,{probeTimeoutMs:t=4e3}={}){let a=de(o);if(!a)return"free";if(!a.wsEndpoint)return a.ownerPid&&a.ownerPid!==process.pid&&ae(a.ownerPid)?"live":(L(o),"free");let f=Symbol("timeout"),i=e.connect({browserWSEndpoint:a.wsEndpoint,defaultViewport:null}).catch(()=>null),p=await le(i,t,f);if(p===f)return i.then(n=>{if(n)try{n.disconnect()}catch{}}),"live";if(!p)return L(o),"free";if(ae(a.ownerPid)){try{p.disconnect()}catch{}return"live"}if(console.log(" (recovered an orphaned automation browser from a previous run \u2014 closing it)"),await le(p.close().then(()=>!0).catch(()=>!1),t,!1))return L(o),"free";try{p.disconnect()}catch{}return"live"}function Oe(e,o){e&&(Ce(),O.add(e),e.on("disconnected",()=>{O.delete(e),o&&L(o)}))}async function pe(e,o={}){let t=oe(),a={...Pe,...o,userDataDir:t},f=`Could not open the LinkedIn automation Chrome profile at ${t}. Another LinkedIn automation command is already running (or its window is still open) \u2014 wait for it to finish or close that window, then retry.`;if(await me(e,t)==="live")throw new Error(f);ue(t);let i;try{i=await e.launch(a)}catch{if(await me(e,t)==="live")throw new Error(f);re(t);try{i=await e.launch(a)}catch(x){throw Le(t),new Error(`Could not open the LinkedIn automation Chrome profile at ${t}. If a LinkedIn automation window is already open, close it and retry. (Chrome: ${x.message})`)}}return Oe(i,t),Ee(t,i),{browser:i,profileDir:t,needsSeed:se(t)}}async function fe(e,o){if(!o||!o.needsSeed)return!1;if(!ee())return console.warn(" \u26A0 No saved LinkedIn session found. If this command comes back empty or redirects to login, run: ilml linkedin login"),!1;try{return await e.setCookie(...Q()),ie(o.profileDir),console.log(" (seeded persistent profile from saved cookies \u2014 one-time)"),!0}catch{return!1}}var A=process.argv.slice(2),Fe=A.includes("--help")||A.includes("-h"),xe=A.includes("--json"),N=A.find(e=>e.startsWith("--save-to-graph="))?.split("=")[1]||null,Y=A.find(e=>e.startsWith("--out="))?.split("=")[1]||null,De=A.includes("--no-comments"),we=A.find(e=>e.startsWith("--comments-max="))?.split("=")[1],qe=we!=null?parseInt(we,10):null,b=A.find(e=>e.startsWith("http")),_=xe?(...e)=>console.error(...e):(...e)=>console.log(...e);function ke(){console.log(`
|
|
14
14
|
read-post \u2014 read ONE LinkedIn post by URL (analysis-first; saving is opt-in)
|
|
15
15
|
|
|
16
16
|
DEFAULT USE CASE
|
|
@@ -71,6 +71,6 @@ WHAT YOU GET ON ONE PAGE LOAD (no extra cost regardless of flags)
|
|
|
71
71
|
BAN RISK
|
|
72
72
|
Low. One post view = a single page load = normal human browsing.
|
|
73
73
|
--no-comments is even quieter (skips the load-more-comments scroll loop).
|
|
74
|
-
`)}
|
|
75
|
-
`);try{let{graph:
|
|
76
|
-
`)}`)}}else console.log(
|
|
74
|
+
`)}Fe&&(ke(),process.exit(0));b||(ke(),process.exit(1));/linkedin\.com\/(posts|feed|in)\/|linkedin\.com\/.*(activity|update)/i.test(b)||(console.error(`URL doesn't look like a LinkedIn post: ${b}`),console.error("Expected something like:"),console.error(" https://www.linkedin.com/posts/<slug>-activity-<id>-xxxx"),console.error(" https://www.linkedin.com/feed/update/urn:li:activity:<id>"),process.exit(1));_("");_(` read-post \u2014 ${b}`);_("");var J=null;try{let e=await pe(je);J=e.browser;let o=await J.newPage();await fe(o,e);let t=await z(o,b,{skipComments:De,commentsMax:qe});t.authWall&&(console.error(" \u26D4 Auth wall \u2014 cookies expired or not logged in."),console.error(" Run 'ilml linkedin login' (or: node src/saveLoginState.mjs) and retry."),process.exit(2));let a=null;if(N){let i=t.author||{},p=t.text||t.cleanText||t.fullText||"",x=(p.replace(/\s+/g," ").trim()||"(empty post)").slice(0,80),n=`${i.name||"unknown"} \u2014 ${x}${x.length===80?"\u2026":""}`,w={url:t.url||b,urn:t.urn||null,author:t.author||null,text:t.text||null,postedAt:t.postedAt||null,hashtags:t.hashtags||[],mentions:t.mentions||[],media:t.media||null,capturedAt:new Date().toISOString()},r=[];i.name&&r.push(`**Author:** ${i.name}${i.headline?` \u2014 ${i.headline}`:""}`),i.profileUrl&&r.push(`**Profile:** ${i.profileUrl}`),t.postedAt&&r.push(`**Posted:** ${t.postedAt}`),r.push(`**Source:** ${b}`),r.push(`**Captured:** ${w.capturedAt.slice(0,10)}`),r.push(""),r.push("---"),r.push(""),r.push(p||"(post text not extracted)"),t.hashtags?.length&&(r.push(""),r.push(`**Hashtags:** ${t.hashtags.join(" ")}`)),t.mentions?.length&&(r.push(""),r.push(`**Mentions:** ${t.mentions.map(s=>`[${s.label||s.kind}](${s.url})`).join(", ")}`));let P=Object.entries(t.media||{}).filter(([,s])=>s).map(([s])=>s.replace(/^has/,"").toLowerCase());P.length&&(r.push(""),r.push(`**Media:** ${P.join(", ")}`)),r.push(""),r.push("---"),r.push(""),r.push("*Live engagement (reactions / comments / reposts) is intentionally NOT saved here \u2014 those drift. Re-run `read-post --json` on the source URL for current numbers.*"),r.push(""),r.push("```json"),r.push(JSON.stringify(w,null,2)),r.push("```");let R=r.join(`
|
|
75
|
+
`);try{let{graph:s}=await Promise.resolve().then(()=>(ye(),ge)),d=await s.addItem(N,{title:n,description:R,tags:["linkedin-post"]}),c=d?.id||d?.item?.id||null;a={parentId:N,nodeId:c,url:c?`https://app.ilivemylife.io/item/${c}`:null},_(""),_(` \u2713 Saved to graph as child of ${N}`),_(` New node: ${c||"(id not returned by SDK)"}`),c&&_(` URL: https://app.ilivemylife.io/item/${c}`),_("")}catch(s){a={parentId:N,error:s.message?.slice(0,200)},console.error(""),console.error(` \u26A0 Failed to save to graph: ${s.message?.slice(0,200)}`),console.error(" The post was still extracted successfully \u2014 printing below."),console.error("")}}let f={...t,...a!==null&&{savedToGraph:a}};if(Y&&((await import("fs")).writeFileSync(Y,JSON.stringify(f,null,2)),_(` \u2713 Wrote ${(JSON.stringify(f).length/1024).toFixed(1)}KB to ${Y}`)),xe)console.log(JSON.stringify(f,null,2));else{let i=t.author||{};console.log(" \u2500\u2500\u2500 POST \u2500\u2500\u2500"),console.log(` Author: ${i.name||"(unknown)"}${i.headline?` \u2014 ${i.headline}`:""}`),i.profileUrl&&console.log(` Profile: ${i.profileUrl}`),t.postedAt&&console.log(` Posted: ${t.postedAt}`);let p=[`${t.reactions||"0"} reactions`,`${t.commentCount||t.comments.length||"0"} comments`,t.repostCount?`${t.repostCount} reposts`:null].filter(Boolean).join(" ");console.log(` Engagement: ${p}`);let x=Object.entries(t.media||{}).filter(([,n])=>n).map(([n])=>n.replace(/^has/,"").toLowerCase());if(x.length&&console.log(` Media: ${x.join(", ")}`),t.hashtags?.length&&console.log(` Hashtags: ${t.hashtags.join(" ")}`),t.mentions?.length&&console.log(` Mentions: ${t.mentions.map(n=>`${n.label||n.url} (${n.kind})`).join(", ")}`),console.log(""),t.commentsTruncated){let n=t.commentsTruncatedReason==="skipComments"?"(comments skipped via --no-comments)":`(showing first ${t.comments.length} of ${t.commentsTruncatedOriginalCount} \u2014 capped via --comments-max)`;console.log(` Note: ${n}`),console.log("")}if(t.comments.length){console.log(t.text||"(post text not parsed \u2014 see cleanText below)"),console.log(""),console.log(` \u2500\u2500\u2500 COMMENTS (${t.comments.length}) \u2500\u2500\u2500`);for(let n of t.comments){let w=n.author||{};console.log(""),console.log(` \u2022 ${w.name||"(unknown)"}${w.headline?` \u2014 ${w.headline}`:""}`),n.text&&console.log(` ${n.text.replace(/\n+/g,`
|
|
76
|
+
`)}`)}}else console.log(t.cleanText||t.fullText||"(no content extracted)");console.log(""),console.log(" (use --json for the full structured object)")}}catch(e){console.error(" Error:",e.message),process.exit(1)}finally{J&&await J.close().catch(()=>{})}
|