<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[thriving_adder]]></title><description><![CDATA[thriving_adder]]></description><link>https://adcens.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 23:53:35 GMT</lastBuildDate><atom:link href="https://adcens.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Full-page screenshots and PDFs of a list of URLs with one API call]]></title><description><![CDATA[Originally published on DEV: Full-page screenshots and PDFs of a list of URLs with one API call Taking one screenshot of a web page is easy. Taking a…]]></description><link>https://adcens.hashnode.dev/full-page-screenshots-and-pdfs-of-a-list-of-urls-with-one-api-call</link><guid isPermaLink="true">https://adcens.hashnode.dev/full-page-screenshots-and-pdfs-of-a-list-of-urls-with-one-api-call</guid><category><![CDATA[Web Development]]></category><category><![CDATA[playwright]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[pdf]]></category><category><![CDATA[automation]]></category><dc:creator><![CDATA[thriving_adder]]></dc:creator><pubDate>Mon, 30 Nov 2026 03:44:02 GMT</pubDate><content:encoded><![CDATA[<p><em>Originally published on DEV: <a href="https://dev.to/adcens/full-page-screenshots-and-pdfs-of-a-list-of-urls-with-one-api-call-3l2j">Full-page screenshots and PDFs of a list of URLs with one API call</a></em></p>
<p>Taking one screenshot of a web page is easy. Taking a full-page screenshot, or a PDF, of fifty pages on mobile and desktop, every week, without a cookie banner covering half of each image, is the part that eats an afternoon.</p>
<p>This post shows the free ways to capture a page yourself, the problems that full-page captures run into, and then how to get a screenshot and/or PDF for every URL in a list with <a href="https://apify.com/thriving_adder/website-screenshot-pdf">Website Screenshot API: Full-Page PNG, JPEG &amp; PDF</a>, an Apify Actor I built and publish as <code>thriving_adder</code>. I earn when it is used. You do not need the Actor to take screenshots.</p>
<h2>Capture a page yourself</h2>
<p>For a few pages, these free options are enough:</p>
<ol>
<li><strong>Chrome DevTools.</strong> Open DevTools, press Ctrl+Shift+P (Cmd+Shift+P on a Mac), type "screenshot" and choose <strong>Capture full size screenshot</strong>. Turn on device mode first for a mobile view.</li>
<li><strong>Firefox.</strong> Right-click the page, choose <strong>Take Screenshot</strong>, then <strong>Save full page</strong>.</li>
<li><strong>Print to PDF.</strong> The browser's print dialog with "Save as PDF" gives you a PDF of the page as the print stylesheet sees it.</li>
<li><strong>Playwright from the command line.</strong> <a href="https://playwright.dev/">Playwright</a>'s CLI can screenshot or print one URL without writing a script (<code>npx playwright screenshot --help</code> lists the options):</li>
</ol>
<pre><code class="language-bash">npx playwright screenshot --full-page https://example.com/ example.png
npx playwright screenshot --device="iPhone 13" --full-page https://example.com/ example-mobile.png
npx playwright pdf https://example.com/ example.pdf
</code></pre>
<p>The first run may ask to download a browser (<code>npx playwright install chromium</code>). PDF output only works in Chromium.</p>
<p>If you only need a handful of pages, stop here. A short loop around the Playwright CLI covers a lot of cases.</p>
<h2>What goes wrong at scale</h2>
<p>Once the list gets longer, the same few problems keep coming back:</p>
<ul>
<li><strong>Cookie and consent banners</strong> cover the top of every capture. Clicking "Accept" automatically means agreeing to tracking on someone else's site, so hiding the banner is usually the better choice.</li>
<li><strong>Lazy-loaded images</strong> stay blank unless the page is scrolled before the capture.</li>
<li><strong>Very tall pages</strong> (long articles, infinite feeds) can hang the browser or produce an image tens of thousands of pixels high.</li>
<li><strong>Slow or broken pages</strong> need a timeout, and you have to keep track of which URLs failed.</li>
<li><strong>Somewhere to put the files</strong> and a way to match each file to its URL.</li>
</ul>
<p>None of this is hard, but it is code you have to write and keep running.</p>
<h2>Capture a list of URLs in one call</h2>
<p>The Actor opens each URL in headless Chrome (Playwright) and saves a PNG or JPEG screenshot, a PDF, or both. It has desktop (1366x768), laptop, tablet and mobile (390x844) presets or a custom size; mobile and tablet render at 2x pixel density. It can capture the full page or only the viewport. Common cookie-consent banners are hidden with CSS (it never clicks "Accept"), and you can hide other elements with your own CSS selectors. Pages taller than 10,000 px (adjustable) are clipped and flagged instead of hanging the run. Each result row has the final URL, the HTTP status code, the page title and a download link for every file.</p>
<p><strong>Capture only pages you are allowed to capture, and respect each site's terms.</strong> By default the Actor respects robots.txt and skips disallowed URLs for free.</p>
<h3>Cost</h3>
<p>Prices below are from the <a href="https://apify.com/thriving_adder/website-screenshot-pdf/pricing">live Store listing</a> on 30 November 2026. Check that page before you run anything, in case they have changed.</p>
<table>
<thead>
<tr>
<th>Event</th>
<th>Price</th>
</tr>
</thead>
<tbody><tr>
<td>Actor start</td>
<td>$0.00005 (one event per GB of memory, minimum one; the default 4 GB run counts as four events, so $0.0002)</td>
</tr>
<tr>
<td>Screenshot (PNG or JPEG), per page</td>
<td>$0.002</td>
</tr>
<tr>
<td>PDF, per page</td>
<td>$0.0025</td>
</tr>
</tbody></table>
<p>Failed pages, rejected URLs (logins, localhost, private networks) and robots.txt skips are free. You only pay for events that actually happen, not the run cap.</p>
<p>Two pages as PNG plus PDF therefore cost $0.009 plus the start fee. One thousand full-page PNGs cost about $2.</p>
<p>Apify's Free plan includes $5 of monthly usage and does not require a credit card (<a href="https://apify.com/pricing">apify.com/pricing</a>, checked 30 November 2026).</p>
<h3>One API call</h3>
<p>Create a free Apify account and copy an API token from <strong>Console &gt; Settings &gt; API &amp; Integrations</strong>. Replace <code>APIFY_TOKEN</code> in the request below. The two URLs are only public examples so you can see the shape of the output. Point <code>urls</code> at pages you are allowed to capture when you run this for real.</p>
<p>This calls Apify's public synchronous endpoint, which waits for the run to finish (up to 300 seconds) and returns the dataset items as JSON. A short list of ordinary pages fits easily. For long lists, use Apify's asynchronous run API instead.</p>
<pre><code class="language-bash">curl -sS --max-time 300 -X POST \
  "https://api.apify.com/v2/acts/thriving_adder~website-screenshot-pdf/run-sync-get-dataset-items?maxTotalChargeUsd=0.05" \
  -H "Authorization: Bearer APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      { "url": "https://example.com/" },
      { "url": "https://www.wikipedia.org/" }
    ],
    "outputFormats": ["png", "pdf"],
    "viewport": "mobile",
    "fullPage": true
  }'
</code></pre>
<p>The same call in JavaScript (Node.js 18 or later; save it as <code>capture.mjs</code> and run <code>node capture.mjs</code>), downloading each file to <code>./output</code>:</p>
<pre><code class="language-javascript">import { mkdir, writeFile } from "node:fs/promises";

const response = await fetch(
  "https://api.apify.com/v2/acts/thriving_adder~website-screenshot-pdf/run-sync-get-dataset-items?maxTotalChargeUsd=0.05",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer APIFY_TOKEN",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      urls: [
        { url: "https://example.com/" },
        { url: "https://www.wikipedia.org/" },
      ],
      outputFormats: ["png", "pdf"],
      viewport: "mobile",
      fullPage: true,
    }),
  },
);

const items = await response.json();
if (!response.ok) {
  throw new Error(`Run failed: ${response.status} ${JSON.stringify(items)}`);
}

await mkdir("output", { recursive: true });
for (const row of items) {
  if (row.error) {
    console.log(`${row.url ?? row.startUrl}: ${row.error}`);
    continue;
  }
  for (const [format, ext] of [["png", "png"], ["jpeg", "jpg"], ["pdf", "pdf"]]) {
    const fileUrl = row[`${format}Url`];
    if (!fileUrl) continue;
    const file = `output/${row[`${format}Key`]}.${ext}`;
    const res = await fetch(fileUrl);
    await writeFile(file, Buffer.from(await res.arrayBuffer()));
    console.log(`${row.url} (${row.statusCode}) -&gt; ${file}`);
  }
}
</code></pre>
<p>Each successful row includes:</p>
<ul>
<li><code>startUrl</code> and <code>url</code> - the URL you sent and the final URL after redirects</li>
<li><code>statusCode</code> and <code>title</code> - the HTTP status and the page's <code>&lt;title&gt;</code></li>
<li><code>viewport</code>, <code>fullPage</code>, <code>pageHeightPx</code> and <code>heightTruncated</code> - what was captured, and whether a very tall page was clipped</li>
<li><code>pngUrl</code> / <code>jpegUrl</code> / <code>pdfUrl</code> - download links for the files, with <code>pngKey</code>, <code>pngBytes</code> and so on</li>
<li><code>takenAt</code> - when the capture was made</li>
</ul>
<p>Rows for pages that failed or were skipped include an <code>error</code> message ending in "(not charged)". The download links point to the run's storage on Apify: treat them like private links, and download the files you want to keep, because unnamed run storage is removed after your plan's data retention period.</p>
<p>The JSON below is only an illustrative shape of a successful row, so you can see the field names. The values are placeholders, not the result of a live run.</p>
<pre><code class="language-json">{
  "startUrl": "https://example.com/",
  "url": "https://example.com/",
  "statusCode": 200,
  "title": "Example Domain",
  "viewport": "390x844",
  "fullPage": true,
  "pageHeightPx": 0,
  "heightTruncated": false,
  "takenAt": "2026-11-30T00:00:00.000Z",
  "pngKey": "png_&lt;hash&gt;",
  "pngUrl": "https://api.apify.com/v2/key-value-stores/&lt;id&gt;/records/png_&lt;hash&gt;",
  "pngBytes": 0,
  "pdfKey": "pdf_&lt;hash&gt;",
  "pdfUrl": "https://api.apify.com/v2/key-value-stores/&lt;id&gt;/records/pdf_&lt;hash&gt;",
  "pdfBytes": 0
}
</code></pre>
<p>A Python script and a Node.js script that save the files locally are in the MIT-licensed <a href="https://github.com/adcens/apify-actor-examples">examples repo</a> under <code>screenshot-pdf/</code>.</p>
<h3>Useful options</h3>
<ol>
<li><code>"viewport": "desktop"</code> (or <code>laptop</code>, <code>tablet</code>, <code>mobile</code>), or set <code>viewportWidth</code> and <code>viewportHeight</code> for a custom size.</li>
<li><code>"outputFormats": ["jpeg"]</code> with <code>"jpegQuality": 70</code> gives much smaller files than PNG.</li>
<li>For single-page apps, set <code>"waitUntil": "networkidle"</code> or add <code>"delayMs": 2000</code>.</li>
<li><code>"scrollToBottom": true</code> scrolls the page first so lazy-loaded images appear.</li>
<li><code>"hideSelectors": [".chat-widget", "#promo-bar"]</code> hides elements the built-in cookie-banner list does not cover.</li>
<li><code>"pdfFormat": "Letter"</code> (or <code>A4</code>, <code>Legal</code>, <code>A3</code>) sets the PDF paper size.</li>
</ol>
<h2>Limits worth knowing</h2>
<ul>
<li>Only public <code>http(s)</code> pages. No logins or cookies. Localhost and private-network addresses are rejected and not charged.</li>
<li>Cookie banners are hidden with a list of common selectors. Unusual consent tools may still show; add their selectors to <code>hideSelectors</code>.</li>
<li>Pages taller than <code>maxPageHeightPx</code> (10,000 px by default) are clipped and flagged with <code>heightTruncated</code>. If a full-page capture still times out, the Actor falls back once to the top 4,000 px and flags that too.</li>
<li>Timeouts are not retried, so a very slow page fails fast (free) instead of holding up the run.</li>
<li><code>respectRobotsTxt</code> defaults to <code>true</code>. Turn it off only for sites you own or have permission to capture.</li>
<li>The copyright in a page's content stays with its owner. A screenshot of a public page is generally fine for your own records, but check before you republish captures.</li>
</ul>
<p>If something looks wrong, open an issue on the <a href="https://apify.com/thriving_adder/website-screenshot-pdf/issues">Actor's Issues tab</a> with the URL and the input you used.</p>
]]></content:encoded></item><item><title><![CDATA[Run Lighthouse on a list of URLs and get one table]]></title><description><![CDATA[Originally published on DEV: Run Lighthouse on a list of URLs and get one table Chrome DevTools and PageSpeed Insights are built for one page at a time. If…]]></description><link>https://adcens.hashnode.dev/run-lighthouse-on-a-list-of-urls-and-get-one-table</link><guid isPermaLink="true">https://adcens.hashnode.dev/run-lighthouse-on-a-list-of-urls-and-get-one-table</guid><category><![CDATA[web performance]]></category><category><![CDATA[Lighthouse]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[SEO]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[thriving_adder]]></dc:creator><pubDate>Mon, 30 Nov 2026 03:43:07 GMT</pubDate><content:encoded><![CDATA[<p><em>Originally published on DEV: <a href="https://dev.to/adcens/run-lighthouse-on-a-list-of-urls-and-get-one-table-4bn4">Run Lighthouse on a list of URLs and get one table</a></em></p>
<p>Chrome DevTools and PageSpeed Insights are built for one page at a time. If you want the same Lighthouse scores and lab Core Web Vitals for every important page on a site, you either click through them one by one or wire up the Lighthouse CLI or the PageSpeed Insights API yourself.</p>
<p>This post explains what those lab numbers mean, shows the free ways to collect them, and then shows how to get one table for a list of URLs with <a href="https://apify.com/thriving_adder/bulk-lighthouse-auditor">Bulk Lighthouse &amp; Core Web Vitals Auditor</a>, an Apify Actor I built and publish as <code>thriving_adder</code>. I earn when it is used. You do not need the Actor to run Lighthouse.</p>
<h2>Lab scores are not field data</h2>
<p><a href="https://web.dev/articles/vitals">Core Web Vitals</a> are the metrics Google uses to describe a page's loading, interactivity and visual stability. In the field (real users, via the Chrome User Experience Report) the three are:</p>
<ul>
<li><strong>LCP</strong> (Largest Contentful Paint): how long the main content takes to appear. The usual "good" threshold is 2.5 seconds or less.</li>
<li><strong>INP</strong> (Interaction to Next Paint): how quickly the page responds to clicks, taps and key presses. The usual "good" threshold is 200 milliseconds or less.</li>
<li><strong>CLS</strong> (Cumulative Layout Shift): how much the layout jumps around. The usual "good" threshold is 0.1 or less.</li>
</ul>
<p>Lighthouse does not watch real users. It loads the page in a lab (a controlled browser, often with a slow-phone simulation) and reports <strong>lab</strong> metrics. Lab LCP and CLS map to the field names above. For interactivity, Lighthouse reports <strong>TBT</strong> (Total Blocking Time) as a lab stand-in for INP, because INP needs real user interactions that a one-shot audit does not have.</p>
<p>That distinction matters. A green Lighthouse report is useful for catching regressions and comparing pages under the same conditions. It is not a substitute for field data in Search Console or CrUX, which is what Google Search uses. Lab scores also vary a little from run to run, even on the same URL.</p>
<p>For a single page, running Lighthouse yourself is often enough. The rest of this post is for when you want the same audit across a list of pages you own or have permission to test.</p>
<h2>Run Lighthouse yourself</h2>
<p>Three free options cover most one-off checks:</p>
<ol>
<li>In Chrome, open DevTools, go to the <strong>Lighthouse</strong> panel, pick the categories and a device, and click <strong>Analyze page load</strong>.</li>
<li>On the command line, the <a href="https://github.com/GoogleChrome/lighthouse">Lighthouse CLI</a> can write an HTML report for one URL:</li>
</ol>
<pre><code class="language-bash">npx lighthouse https://www.python.org/ --output html --output-path ./report.html
</code></pre>
<p>By default that uses the mobile preset. Add <code>--preset=desktop</code> for a desktop run. Point the URL at a page you are allowed to audit.</p>
<ol start="3">
<li><a href="https://pagespeed.web.dev/">PageSpeed Insights</a> runs Lighthouse for one public URL and also shows field data when enough CrUX traffic exists. Google's <a href="https://developers.google.com/speed/docs/insights/v5/get-started">PageSpeed Insights API</a> does the same thing with a key and a quota, one URL per request.</li>
</ol>
<p>If you only have a handful of pages, stop here. If you want one JSON or CSV table for a list of URLs, without managing a Google API key, the next section is one way to do that.</p>
<h2>Audit a list of URLs in one call</h2>
<p>The Actor runs the open-source Lighthouse 13 engine in headless Chrome, once per URL and device. The mobile preset emulates a Moto G Power on slow 4G with simulated throttling, in the same style as PageSpeed Insights mobile. Desktop is optional. For each finished audit it returns the Performance, Accessibility, Best Practices and SEO scores (0-100), lab LCP, CLS, TBT, FCP, Speed Index, TTI and TTFB, whether the lab Core Web Vitals thresholds passed (LCP of 2,500 ms or less, CLS of 0.1 or less, TBT of 200 ms or less), the top opportunities with estimated savings, failed audit ids, and a link to the full interactive HTML report.</p>
<p><strong>Use this on a site you own or have permission to audit.</strong></p>
<h3>Cost</h3>
<p>Prices below are from the <a href="https://apify.com/thriving_adder/bulk-lighthouse-auditor/pricing">live Store listing</a> on 29 November 2026. Check that page before you run anything, in case they have changed.</p>
<table>
<thead>
<tr>
<th>Event</th>
<th>Price</th>
</tr>
</thead>
<tbody><tr>
<td>Actor start</td>
<td>$0.00005 (one event per GB of memory, minimum one; the default 4 GB run counts as four events, so $0.0002)</td>
</tr>
<tr>
<td>Lighthouse audit (one URL, one device)</td>
<td>$0.012</td>
</tr>
<tr>
<td>Second device for the same URL (mobile + desktop)</td>
<td>$0.010</td>
</tr>
</tbody></table>
<p>Failed, blocked, and robots.txt-skipped pages are free. You only pay for events that actually happen, not the run cap.</p>
<p>A two-page mobile run therefore costs about $0.024 plus the start fee. One hundred mobile audits cost about $1.20 plus the start fee. Adding desktop for the same URLs bills the second device at $0.010 each, so two pages on mobile and desktop cost about $0.044 plus the start fee.</p>
<p>Apify's Free plan includes $5 of monthly usage and does not require a card (<a href="https://apify.com/pricing">apify.com/pricing</a>, checked 29 November 2026).</p>
<h3>One API call</h3>
<p>Create a free Apify account and copy an API token from <strong>Console &gt; Settings &gt; API &amp; Integrations</strong>. Replace <code>APIFY_TOKEN</code> in the request below. The two URLs are only public examples so you can see the shape of the output. Point <code>urls</code> at pages you are allowed to audit when you run this for real.</p>
<p>This calls Apify's public synchronous endpoint, which waits for the run to finish (up to 300 seconds) and returns the dataset items as JSON. Each audit typically takes about 10-40 seconds, so two mobile pages usually fit. Set a long enough client timeout. For longer lists, use Apify's asynchronous run API instead.</p>
<pre><code class="language-bash">curl -sS --max-time 300 -X POST \
  "https://api.apify.com/v2/acts/thriving_adder~bulk-lighthouse-auditor/run-sync-get-dataset-items?maxTotalChargeUsd=0.05" \
  -H "Authorization: Bearer APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      { "url": "https://www.python.org/" },
      { "url": "https://www.gov.uk/" }
    ],
    "devices": ["mobile"]
  }'
</code></pre>
<p>The same call in JavaScript:</p>
<pre><code class="language-javascript">const response = await fetch(
  "https://api.apify.com/v2/acts/thriving_adder~bulk-lighthouse-auditor/run-sync-get-dataset-items?maxTotalChargeUsd=0.05",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer APIFY_TOKEN",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      urls: [
        { url: "https://www.python.org/" },
        { url: "https://www.gov.uk/" },
      ],
      devices: ["mobile"],
    }),
  },
);

const items = await response.json();
if (!response.ok) {
  throw new Error(`Run failed: ${response.status} ${JSON.stringify(items)}`);
}

for (const row of items) {
  if (row.error) {
    console.log(`${row.url} (${row.device}): ${row.errorCode ?? row.error}`);
    continue;
  }
  const scores = row.scores ?? {};
  console.log(
    `${row.url} (${row.device}): perf ${scores.performance}, LCP ${row.lcpMs} ms, CLS ${row.cls}, TBT ${row.tbtMs} ms, CWV pass ${row.coreWebVitalsPass}`,
  );
  console.log(row.reportUrl);
}
</code></pre>
<p>Each successful row includes:</p>
<ul>
<li><code>scores</code> - category scores from 0-100: <code>performance</code>, <code>accessibility</code>, <code>bestPractices</code>, <code>seo</code> (only the categories you requested)</li>
<li><code>lcpMs</code>, <code>cls</code>, <code>tbtMs</code> - lab Core Web Vitals (TBT is the lab proxy for INP), plus <code>fcpMs</code>, <code>speedIndexMs</code>, <code>ttiMs</code> and <code>ttfbMs</code></li>
<li><code>coreWebVitalsPass</code> - <code>true</code> when lab LCP is 2,500 ms or less, CLS is 0.1 or less, and TBT is 200 ms or less</li>
<li><code>opportunities</code> - up to eight improvement opportunities, each with <code>id</code>, <code>title</code>, optional <code>savingsMs</code> / <code>savingsBytes</code>, and <code>displayValue</code></li>
<li><code>failedAudits</code> - ids of binary audits that failed, such as <code>image-alt</code> or <code>meta-description</code></li>
<li><code>reportUrl</code> - a link to the full Lighthouse HTML report in the run's key-value store</li>
<li><code>lighthouseVersion</code>, <code>benchmarkIndex</code> and <code>auditedAt</code></li>
</ul>
<p>Rows that fail or are skipped include <code>error</code> and a machine-readable <code>errorCode</code> (for example <code>ERRORED_DOCUMENT_REQUEST</code>, <code>AUDIT_TIMEOUT</code>, <code>ROBOTS_DISALLOWED</code>, <code>BLOCKED_NON_PUBLIC</code> or <code>INVALID_URL</code>). Those rows are not charged.</p>
<p>The JSON below is only an illustrative shape of a successful row, so you can see the field names. The numbers are placeholders, not the result of a live audit. Lab scores change from run to run.</p>
<pre><code class="language-json">{
  "url": "https://www.python.org/",
  "device": "mobile",
  "finalUrl": "https://www.python.org/",
  "scores": {
    "performance": 0,
    "accessibility": 0,
    "bestPractices": 0,
    "seo": 0
  },
  "lcpMs": 0,
  "cls": 0,
  "tbtMs": 0,
  "fcpMs": 0,
  "coreWebVitalsPass": false,
  "opportunities": [
    {
      "id": "unused-javascript",
      "title": "Reduce unused JavaScript",
      "savingsMs": 0,
      "savingsBytes": 0,
      "displayValue": "Est savings of 0 ms"
    }
  ],
  "failedAudits": ["image-alt"],
  "reportUrl": "https://api.apify.com/v2/key-value-stores/&lt;id&gt;/records/&lt;report&gt;",
  "lighthouseVersion": "13.x",
  "benchmarkIndex": 0,
  "auditedAt": "2026-11-29T00:00:00.000Z"
}
</code></pre>
<p>A Python script that writes the same fields to a CSV you can import into Google Sheets is in the MIT-licensed <a href="https://github.com/adcens/apify-actor-examples">examples repo</a> under <code>bulk-lighthouse/</code>.</p>
<h3>After you get the table</h3>
<ol>
<li>Sort or filter on <code>coreWebVitalsPass</code> and the performance score. Start with the pages that fail the lab thresholds, and read the <code>opportunities</code> list for the biggest estimated savings.</li>
<li>Open <code>reportUrl</code> when you need the full Lighthouse view (filmstrip, audits and traces), not just the summary row.</li>
<li>For pages that matter, run the audit two or three times and use the median. Lab scores always move a little.</li>
<li>To add desktop, set <code>"devices": ["mobile", "desktop"]</code>. That produces two rows per URL, with the second device billed at $0.010.</li>
<li>Keep <code>maxConcurrency</code> at 1 if you want the most stable scores. A value of 2 needs the run memory set to 8 GB.</li>
</ol>
<p>If you also want the raw Lighthouse JSON (the LHR, typically about 0.5-2 MB per audit), set <code>"saveJsonReport": true</code> and read <code>jsonReportUrl</code>.</p>
<h2>Limits worth knowing</h2>
<ul>
<li>These are lab metrics, not field (CrUX) data. A passing or failing <code>coreWebVitalsPass</code> flag is based on the lab thresholds above, not on real-user data.</li>
<li>Scores are not identical to PageSpeed Insights. Simulated throttling makes them comparable, but hardware, location and Lighthouse version still differ.</li>
<li><code>respectRobotsTxt</code> defaults to <code>true</code>. The Actor identifies itself as <code>LighthouseAuditBot</code>. Skipped URLs are free and come back with <code>errorCode</code> <code>ROBOTS_DISALLOWED</code>. Turn this off only for sites you own or have permission for.</li>
<li>Only public <code>http(s)</code> pages. No logins, cookies or paywalls. Localhost and private-network addresses are rejected and not charged, including redirects and embedded resources.</li>
<li>Each audit typically takes about 10-40 seconds. The synchronous endpoint times out at HTTP 408 after 300 seconds; for more than a handful of URLs, start an asynchronous run instead. The Actor accepts up to 2,000 URLs per run.</li>
<li>The default run uses 4 GB of memory so Lighthouse has a full CPU core. That is also why the start fee is four start events ($0.0002) rather than one.</li>
</ul>
<p>If something looks wrong, open an issue on the <a href="https://apify.com/thriving_adder/bulk-lighthouse-auditor/issues">Actor's Issues tab</a> with the URL and the input you used.</p>
]]></content:encoded></item><item><title><![CDATA[Generate an llms.txt for your docs site]]></title><description><![CDATA[Originally published on DEV: Generate an llms.txt for your docs site Agents that read your documentation often have to wade through navigation, cookie…]]></description><link>https://adcens.hashnode.dev/generate-an-llms-txt-for-your-docs-site</link><guid isPermaLink="true">https://adcens.hashnode.dev/generate-an-llms-txt-for-your-docs-site</guid><category><![CDATA[AI]]></category><category><![CDATA[llm]]></category><category><![CDATA[documentation]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[RAG ]]></category><dc:creator><![CDATA[thriving_adder]]></dc:creator><pubDate>Mon, 30 Nov 2026 03:40:58 GMT</pubDate><content:encoded><![CDATA[<p><em>Originally published on DEV: <a href="https://dev.to/adcens/generate-an-llmstxt-for-your-docs-site-1md4">Generate an llms.txt for your docs site</a></em></p>
<p>Agents that read your documentation often have to wade through navigation, cookie banners and other page chrome before they reach the actual content. An <code>llms.txt</code> file is a short, curated Markdown map of a site - proposed at <a href="https://llmstxt.org">llmstxt.org</a> - that points them at the pages that matter.</p>
<p>This post explains the current format, shows how to write a file by hand (often the right first step), and then shows how to generate a first draft with <a href="https://apify.com/thriving_adder/web-to-markdown-llms-txt">Web to Markdown &amp; llms.txt</a>, an Apify Actor I built and publish as <code>thriving_adder</code>. I earn when it is used. You do not need the Actor to publish an <code>llms.txt</code>.</p>
<h2>What an llms.txt looks like</h2>
<p>The proposal is now in its second version (updated August 2026). The file is Markdown, usually published at <code>/llms.txt</code>, or at a sub-path such as <code>/docs/llms.txt</code> if it should only cover that section of the site.</p>
<p>The only required part is an H1 with the project or site name. After that, the usual structure is:</p>
<pre><code class="language-markdown"># Title

&gt; Optional description goes here

Optional details go here

## Section name

- [Link title](https://link_url): Optional link details

## Optional

- [Link title](https://link_url)
</code></pre>
<p>A few rules that matter when you write or edit one:</p>
<ul>
<li>The H1 is required. The blockquote is a short summary of the project.</li>
<li>Between the summary and the first H2 you can add notes, but not more headings.</li>
<li>Each H2 introduces a list of links. Every item is a Markdown link, optionally followed by a colon and a one-line description.</li>
<li>By convention, a section named <code>Optional</code> holds secondary links an agent can skip when it needs a shorter context.</li>
</ul>
<p>The file is meant to stay small enough to fit in a context window. The detail lives on the pages you link to. The proposal also encourages clean Markdown versions of those pages (for example <code>page.md</code> next to the HTML) and <code>rel="describedby"</code> / <code>rel="alternate"</code> hints so clients can find them. That part is useful, but you can publish a useful <code>llms.txt</code> without it.</p>
<p>For a small docs site, writing the file yourself is often enough. Pick the 10-20 pages an agent should read first, give each a clear title and one-line description, and put secondary material under <code>## Optional</code>. Several documentation platforms (Mintlify, GitBook, and some WordPress plugins, among others) can also generate a file automatically. After you publish it, test it: give an agent only the file and ask questions about your product.</p>
<p>The rest of this post is for when you want a first draft to edit, generated from a site you already have.</p>
<h2>Generate a first draft</h2>
<p>The Actor fetches public pages over HTTP (no headless browser), strips menus, footers and cookie banners, reads titles and descriptions, groups pages by URL path, and writes a spec-compliant <code>llms.txt</code>. It discovers pages from the site's sitemap, or from home-page links if there is no usable sitemap. By default it respects <code>robots.txt</code> and AI opt-outs (<code>noai</code> in robots tags, and robots.txt rules that block common AI crawlers such as GPTBot). JavaScript-only pages come back with the error code <code>EMPTY_CONTENT</code> and are not charged.</p>
<p><strong>Use this on a site you own or have permission to work with.</strong> Review and edit the file before you publish it. Converting a page does not give you the right to republish someone else's content.</p>
<h3>Cost</h3>
<p>Prices below are from the <a href="https://apify.com/thriving_adder/web-to-markdown-llms-txt">live Store listing</a> on 25 November 2026. Check that page before you run anything, in case they have changed.</p>
<table>
<thead>
<tr>
<th>Event</th>
<th>Price</th>
</tr>
</thead>
<tbody><tr>
<td>Actor start</td>
<td>$0.00005 (one event per GB of memory, minimum one; the default 512 MB run counts as one event)</td>
</tr>
<tr>
<td>Page converted to Markdown</td>
<td>$0.001</td>
</tr>
<tr>
<td>llms.txt generated</td>
<td>$0.02</td>
</tr>
</tbody></table>
<p>The $0.02 <code>llms.txt</code> price covers reading and listing up to <code>maxPagesPerSite</code> pages in that file. If you also turn on <code>generateLlmsFullTxt</code>, each included page is charged as a page conversion ($0.001) as well. Failed, non-HTML, blocked, and robots.txt or AI-opt-out skipped pages are free.</p>
<p>A 10-page <code>llms.txt</code> draft therefore costs about $0.02 plus the start fee. The Actor requires a run cap (<code>maxTotalChargeUsd</code>) of at least $0.03; you only pay for events that actually happen, not the cap.</p>
<p>Apify's Free plan includes $5 of monthly usage and does not require a card (<a href="https://apify.com/pricing">apify.com/pricing</a>, checked 25 November 2026).</p>
<h3>One API call</h3>
<p>Create a free Apify account and copy an API token from <strong>Console -&gt; Settings -&gt; API &amp; Integrations</strong>. Replace <code>APIFY_TOKEN</code> in the request below. The Python 3 docs URL is only a public example so you can see the shape of the output - point <code>llmsTxtSites</code> at your own docs home, or at a sub-path such as <code>https://example.com/docs/</code>, when you generate a file you intend to publish.</p>
<p>This calls Apify's public synchronous endpoint, which waits for the run to finish (up to 300 seconds) and returns the dataset items as JSON. Ten pages is usually well under that limit. Set a long enough client timeout.</p>
<pre><code class="language-bash">curl -sS --max-time 300 -X POST \
  "https://api.apify.com/v2/acts/thriving_adder~web-to-markdown-llms-txt/run-sync-get-dataset-items?maxTotalChargeUsd=0.03" \
  -H "Authorization: Bearer APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "llmsTxtSites": [{ "url": "https://docs.python.org/3/" }],
    "maxPagesPerSite": 10
  }'
</code></pre>
<p>The same call in JavaScript:</p>
<pre><code class="language-javascript">const response = await fetch(
  "https://api.apify.com/v2/acts/thriving_adder~web-to-markdown-llms-txt/run-sync-get-dataset-items?maxTotalChargeUsd=0.03",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer APIFY_TOKEN",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      llmsTxtSites: [{ url: "https://docs.python.org/3/" }],
      maxPagesPerSite: 10,
    }),
  },
);

const items = await response.json();
if (!response.ok) {
  throw new Error(`Run failed: ${response.status} ${JSON.stringify(items)}`);
}

const site = items.find((item) =&gt; item.type === "llms-txt");
if (!site || site.error) {
  throw new Error(site?.error ?? "No llms.txt row in the result");
}

console.log(`${site.site}: ${site.pageCount} pages via ${site.discovery}`);
console.log(site.llmsTxt);
</code></pre>
<p>The site row (<code>type</code> is <code>"llms-txt"</code>) includes:</p>
<ul>
<li><code>llmsTxt</code> - the file text</li>
<li><code>pageCount</code> - how many pages were listed</li>
<li><code>discovery</code> - <code>sitemap</code>, <code>home-page-links</code>, or <code>sitemap+home-page-links</code></li>
<li><code>sections</code> - the H2 groups it built from URL paths</li>
<li><code>existingLlmsTxt</code> - whether the site already publishes <code>/llms.txt</code></li>
<li><code>llmsTxtUrl</code> - a download URL for the file in the run's key-value store</li>
</ul>
<p>Here is a shortened example of a previously generated draft for the public Python 3 docs, so you can see the format (not something to publish as your own):</p>
<pre><code class="language-markdown"># Python documentation

&gt; The official Python documentation.

This file lists the main pages of docs.python.org/3/ for large language models, following the llms.txt proposal (https://llmstxt.org).

## Main

- [Python 3.15 documentation](https://docs.python.org/3/): The official Python documentation.
- [About this documentation](https://docs.python.org/3/about.html): Python's documentation is generated from reStructuredText sources using Sphinx...

## Faq

- [Python Frequently Asked Questions](https://docs.python.org/3/faq/index.html): General Python FAQ, Programming FAQ, Design and History FAQ...
</code></pre>
<p>Copy-paste versions of this script, plus a curl one-pager and a Python example that writes Markdown chunks for RAG, are in the MIT-licensed <a href="https://github.com/adcens/apify-actor-examples">examples repo</a> under <code>web-to-markdown/</code>.</p>
<h3>After you get the file</h3>
<ol>
<li>Read it. Drop pages an agent does not need. Tighten the blockquote summary. Move secondary links under a section named <code>## Optional</code>.</li>
<li>Check <code>existingLlmsTxt</code> so you do not overwrite a file you already publish without meaning to.</li>
<li>If the draft included pages you wanted to skip, rerun with <code>includeUrlPattern</code> or <code>excludeUrlPattern</code> (regular expressions, for example <code>/(tag|author|page)/</code>).</li>
<li>Publish the edited file at <code>/llms.txt</code> or at the sub-path it should cover, then test it with an agent.</li>
</ol>
<p>If you also want a single file that contains the cleaned Markdown of every listed page, set <code>"generateLlmsFullTxt": true</code>. Each of those pages is then charged at $0.001, so a 10-page <code>llms-full.txt</code> is about $0.03 plus the start fee. Raise <code>maxTotalChargeUsd</code> to <code>0.05</code> if you use this option. Some teams keep that file internal; some publish it next to <code>llms.txt</code>.</p>
<h2>Clean Markdown for individual pages</h2>
<p>The same Actor can convert specific public URLs to cleaned Markdown, with optional heading-aware chunks for embeddings. This uses the <code>urls</code> field, not <code>llmsTxtSites</code>. A two-page run with 400-token chunks looks like this and costs $0.002 plus the start fee:</p>
<pre><code class="language-bash">curl -sS --max-time 300 -X POST \
  "https://api.apify.com/v2/acts/thriving_adder~web-to-markdown-llms-txt/run-sync-get-dataset-items?maxTotalChargeUsd=0.03" \
  -H "Authorization: Bearer APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      { "url": "https://www.python.org/about/" },
      { "url": "https://docs.python.org/3/tutorial/index.html" }
    ],
    "chunkTokens": 400,
    "chunkOverlapTokens": 40
  }'
</code></pre>
<p>Each successful page row includes <code>markdown</code>, <code>title</code>, <code>description</code>, <code>wordCount</code>, <code>tokensEstimate</code>, and, when <code>chunkTokens</code> is greater than 0, a <code>chunks</code> array with heading paths. Email addresses and phone numbers are redacted by default.</p>
<p>Only convert pages you are allowed to use. The publisher's copyright still applies.</p>
<h2>Limits worth knowing</h2>
<ul>
<li>There is no headless browser. Pages that render their content only in JavaScript return <code>EMPTY_CONTENT</code> (free). Most docs, blogs and company sites that are server-rendered work.</li>
<li>Only public <code>http(s)</code> pages. No logins, cookies or paywalls. Localhost and private-network addresses are rejected and not charged.</li>
<li><code>respectRobotsTxt</code> and <code>respectAiOptOuts</code> default to <code>true</code>. Skipped pages are free. Turn those off only for sites you own or have permission for.</li>
<li><code>maxPagesPerSite</code> defaults to 25 and accepts 1-500. A short <code>llms.txt</code> usually means the sitemap or home page did not expose more allowed URLs, or you hit the cap.</li>
<li>If the synchronous endpoint times out (HTTP 408 after 300 seconds), start a smaller run or use Apify's asynchronous run API instead.</li>
</ul>
<p>If something looks wrong, open an issue on the <a href="https://apify.com/thriving_adder/web-to-markdown-llms-txt/issues">Actor's Issues tab</a> with the URL and the input you used.</p>
]]></content:encoded></item></channel></rss>