Utilities
Pull links and fields from saved HTML
pup is a command-line tool for processing HTML that reads from stdin, prints to stdout, and filters parts of the page using CSS selectors, inspired by jq as a fast and flexible way of exploring HTML from the terminal.
installgo get github.com/ericchiang/pupbrew install pup
HTML · MIT license
Free plan: 1 user, 3 execution slots, no card.
overview
What pup does
pup is the extraction slot after a page fetch. Pass an HTML file and a CSS selector expression; it returns matching nodes, text{}, or attr{href} values as a flat list.
Reach for it when regex against raw markup is brittle. Selectors like a[href], td, or :contains keep only the elements the next stage needs.
Trickest runs pup as a managed Utilities node: HTML file and selector in, file and folder out. Prefer jq or gron for JSON; unfurl when you already have URLs.
source github.com/ericchiang/pup
use cases
pup use cases
Extract links from a fetched page
Select a[href] and ask for attr{href} so pup returns a clean list of links from a page, ready for a crawler or prober downstream.
Pull values out of an HTML table
Target the right td or row with a CSS selector and emit text{} to turn a results table into a flat list the workflow can consume.
Scrape specific fields without regex
Use a precise selector to grab only the elements you want, avoiding brittle regular expressions against raw markup.
Filter hosts mentioned in page text
Combine :contains with text{} to keep only cells or nodes that mention a domain such as example.com before the next stage runs.
reference
pup inputs and flags
| Name | Type | Flag | Description |
|---|---|---|---|
| file | FILE | · | Input HTML file to process. |
| input | STRING | · | Selector expression, e.g. td :contains(".example.com") text{}. |
Showing key inputs. pup exposes 2 inputs in total.
example
pup command examples
# extract hrefs from a saved HTML page (pup reads stdin)
# pup selector: a attr{href}
cat page.html | pup 'a attr{href}'https://www.example.com/
https://api.example.com/v1/status
https://app.example.com/login
https://dev.example.com/health
https://staging.example.com/docs
https://cdn.example.net/assets/app.js
https://static.example.org/logo.svgguidance
pup vs alternatives
Use pup when you have HTML and need specific elements via CSS selectors, the way jq pulls fields from JSON. It parses pages; it does not fetch them. Run a request stage first. Prefer jq or gron for JSON payloads.
faq
pup FAQ
related
More Utilities tools
dnsgen
Wordlist and mined-word subdomain permutation.
unfurl
Extract chosen URL parts from stdin into clean line lists.
browser-fetch
Headless Chromium render: requested URL, final URL, status, and title next to the page.
cewl
Spider a URL and return a wordlist for password crackers.
csvkit
SQL on one CSV. The table name is the file stem.
duckdb
In-process SQL on CSV, JSON, and Parquet. No server.
Run pup yourself
An HTML page feeds pup, which selects the links with a CSS selector and hands them to httpx to probe before the live links land as output.
Facts on this page come from the live Trickest tool library.