Parse HTML With htmlq

Select and extract HTML nodes with CSS selectors on the command line.

macOShtmltextparsingLow risk
Run curl -s https://example.com | htmlq --text title to print the page title.

01Command

Command
$ curl -s https://example.com | htmlq --text title

02What it does

htmlq reads HTML on standard input and applies a CSS selector, printing matching elements, attributes or text. It plays the same role for HTML that jq plays for JSON, and composes naturally with curl in pipelines.

03Risk

RiskLow risk
CompatibilitymacOS with Homebrew installed
!Warning: It parses static HTML only; JavaScript-rendered content will not be present.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Homebrew formula: htmlq
    Homebrew · vendor-doc · 2026-09-20
    Evidence: Uses CSS selectors to extract bits content from HTML files. Packages htmlq, which extracts HTML using CSS selectors like jq for HTML.

Last verified: 2026-09-22 · Category: Developer

06Related solutions