Parse HTML With htmlq
Select and extract HTML nodes with CSS selectors on the command line.
Run curl -s https://example.com | htmlq --text title to print the page title.
01Command
Command
$ curl -s https://example.com | htmlq --text title02What 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
!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: htmlqEvidence: 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