Updated Jul 15, 2026

Utilities

Pull links and fields from saved HTML

CSS selectors over HTML, the jq counterpart for markup.

Agent

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

Where pup fits

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

2 inputs
NameTypeFlagDescription
fileFILE·Input HTML file to process.
inputSTRING·Selector expression, e.g. td :contains(".example.com") text{}.

Showing key inputs. pup exposes 2 inputs in total.

example

Run pup

pup · command
# extract hrefs from a saved HTML page (pup reads stdin)# pup selector: a attr{href}cat page.html | pup 'a attr{href}'
sample output
https://www.example.com/https://api.example.com/v1/statushttps://app.example.com/loginhttps://dev.example.com/healthhttps://staging.example.com/docshttps://cdn.example.net/assets/app.jshttps://static.example.org/logo.svg

guidance

Choosing pup

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.

gron

Flattens JSON into greppable lines. JSON-side counterpart to pup HTML extraction.

unfurl

Pulls structured pieces out of URLs. Use when you already have links, not raw HTML.

cariddi

Crawls and extracts links, secrets, and endpoints in one pass. Heavier than a pure selector step.

faq

pup questions

Append a display function to the selector, such as text{} for inner text or attr{href} for an attribute value.

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.