loading
loading
Utilities
A command-line tool for processing HTML with CSS selectors.
overview
pup reads HTML and lets you pull out exactly the parts you want using CSS selectors, the same syntax you would use in a stylesheet or in the browser console. It is the HTML counterpart to jq: instead of writing a fragile regex against raw markup, you select td, a[href], or .result and ask for the text, an attribute, or the matching nodes back.
That makes it the extraction step in a scraping or recon pipeline. After a request fetches a page, pup carves out the link table, the email column, or the hidden form fields, and emits a clean list the rest of the workflow can act on. Selectors compose with display functions like text{} and attr{href} so you decide what shape comes out.
On Trickest it is a Utilities node that takes an HTML file and a selector expression, and writes a file and a folder of results. Slot it after a fetch stage to convert a page into structured data without hand-written parsing.
source github.com/ericchiang/pup
use cases
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.
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.
Use a precise selector to grab only the elements you want, avoiding brittle regular expressions against raw markup.
Combine :contains with text{} to keep only cells or nodes that mention a domain such as example.com before the next stage runs.
reference
| 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
# 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/statushttps://app.example.com/loginhttps://dev.example.com/healthhttps://staging.example.com/docshttps://cdn.example.net/assets/app.jshttps://static.example.org/logo.svgguidance
Use pup when you have HTML and want specific elements out of it via CSS selectors, the way jq pulls fields from JSON. It parses pages, it does not fetch them, so run a request stage in front. For JSON data, reach for jq or gron instead.
Flattens JSON into greppable lines. The JSON-side counterpart to pup's HTML extraction.
Pulls structured pieces out of URLs. Use it when you already have links, not raw HTML.
Crawls and extracts links, secrets, and endpoints in one pass. Heavier than pup's pure selector step.
faq
related
Import, export, and link workflow data with Airtable.
Decode Android APK files into smali sources and resources.
Check a file's values against conditions and exit with a matching code.
Extract all hosted zones from AWS Route53.
Output file lines by batch size, given START_LINE and END_LINE.
Extract a batch range from a file's lines or a folder's files, with parallel processing.
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.