Skip to content

Page Extraction CLI

maho page is the content-oriented side of the CLI. Where maho tab manages browser state, maho page turns the rendered page into data you can read, save, search, or pipe into another program.

The current page command family is:

maho page text
maho page markdown
maho page extract …
maho headless <url>

Use the live page commands when the page is already open in Maho. Use headless when the URL itself is the input to your shell pipeline.

Returns readable text from the rendered page rather than raw HTML.

Terminal window
maho page text
maho page text > article.txt

This is the lowest-noise format for ordinary Unix text tools:

Terminal window
maho page text | wc -w
maho page text | rg -n 'security|permission|credential'

Use text when structure is not important and you primarily care about the words a user can read.

Returns the rendered page as Markdown suitable for preserving headings, lists, links, and other document structure without carrying the full HTML DOM.

Terminal window
maho page markdown
maho page markdown > article.md

Markdown is usually the best input for an LLM because it preserves useful semantic structure with substantially less markup noise than HTML:

Terminal window
maho page markdown \
| llm 'Summarize this page. Preserve the heading structure and cite section names.'

A fact-extraction pipeline can stay equally small:

Terminal window
maho page markdown \
| llm 'Return only the product names, prices, and stated limitations as JSON.' \
| jq '.'

llm in these examples is an external stdin-capable model CLI; it is not a required Maho dependency. You can replace it with any local or cloud model tool that reads stdin.

extract is the structured extraction entry point for cases where full-page text or Markdown is too broad.

Terminal window
maho page extract --help

Pass the selector/extraction arguments shown by the installed build, then use --json when the result will be processed programmatically:

Terminal window
maho --json page extract <extraction-arguments> | jq '.'

This split is deliberate:

  • text is optimized for readable words.
  • markdown preserves document structure.
  • extract is for targeted/structured page data.
  • tab html is for the markup itself.
maho headless <url>

maho headless renders a URL through Maho without requiring you to prepare the active GUI tab first, then writes the rendered page result to stdout.

Terminal window
maho headless https://example.com

This makes it a natural source command in pipelines:

Terminal window
maho headless https://example.com \
| llm 'Give me a one-paragraph summary and a list of outbound links mentioned in the content.'

Or save the browser-rendered result before doing anything model-dependent:

Terminal window
maho headless https://example.com > rendered-page.txt
llm 'Summarize the page and identify unsupported claims.' < rendered-page.txt

The second form is especially useful for debugging: you can inspect exactly what the browser produced before deciding whether a downstream model answer is wrong because of extraction or because of reasoning.

curl downloads an HTTP response. maho headless goes through a browser rendering path. That distinction matters for pages whose useful content appears after client-side rendering or depends on browser/profile state.

Use curl when you want the wire response. Use maho headless when you want browser-rendered page content.

InputCommand
The page already open in the browsermaho page text, markdown, or extract
A URL in a scriptmaho headless <url>
Raw DOM/markup from the current tabmaho tab html
Explicit trusted JavaScript against a tabmaho tab eval

Global --json is intended for structured CLI results. Put it at the Maho boundary rather than trying to turn human-readable output back into JSON later:

Terminal window
maho --json page extract <extraction-arguments> \
| jq '.'

For exploratory work, start with jq '.', inspect the actual result emitted by your installed build, then narrow the query:

Terminal window
maho --json page extract <extraction-arguments> | jq '.'

That avoids scripts depending on column spacing or a guessed wrapper object.

Terminal window
maho page markdown \
| llm 'Summarize in five bullets. Keep concrete dates, names, and numbers.'
Terminal window
maho page markdown \
| llm 'Return a JSON array of factual claims that should be independently verified.' \
| jq '.'

Compare two URLs without copying pages by hand

Section titled “Compare two URLs without copying pages by hand”
Terminal window
{
echo '# Source A'
maho headless https://example.com/a
echo '# Source B'
maho headless https://example.com/b
} | llm 'Compare these sources. List agreements, contradictions, and missing evidence.'
Terminal window
maho page markdown | tee /tmp/current-page.md \
| llm 'Produce a concise briefing from this page.'

tee gives you an audit/debug copy of the exact extracted content that entered the model pipeline.

Page extraction can expose whatever the selected browser surface is allowed to read. Treat stdout as potentially sensitive data: shell history, redirected files, terminal scrollback, and downstream programs are all outside the page once content has been emitted.

MCP uses a stricter typed tool surface with browser-side redaction and approval policies. In particular, the MCP server intentionally does not expose the CLI’s generic JavaScript evaluation primitive. If an AI client should choose browser actions dynamically, use maho mcp rather than wrapping maho tab eval as an agent tool.