Skip to content
PeriplusDocs
Open app
Turn article sections into rows

Turn article sections into rows

Compare the topics covered by reports, product guides, or research articles without reading every page manually.

SQL
WITH selected_docs AS (
  SELECT DISTINCT capture_id
  FROM captures
  WHERE startsWith(url, 'https://example.com/research/')
    AND capture_id IS NOT NULL
  ORDER BY capture_id
  LIMIT 20
)
SELECT s.capture_id, m.node_index,
       node_text(s.capture_id, m.node_index) AS heading
FROM selected_docs AS s
CROSS JOIN LATERAL query_selector_all(s.capture_id, 'article h2') AS m
ORDER BY s.capture_id, m.node_index;
Open in SQL workspaceLoads without running

What you get

One row per matching section heading, in document order. This turns repeated HTML structure into a small table you can analyze in a notebook.

Adapt it

Replace the URL prefix and inspect the source markup before changing article h2. The sample selects up to 20 captures, not the latest 20 pages.

Notes

Selectors describe structure, not meaning. No rows may mean the site uses different markup. CSS matching runs on stored HTML, not a live browser.

Continue in Python