HTML Extractor
Extract data from HTML pages with CSS selectors into JSON or CSV.
Install
irm https://raw.githubusercontent.com/chayprabs/localtools/main/html-extractor/install.ps1 | iexlocaltools-html-extractor updatelocaltools-html-extractor uninstall
curl -fsSL https://raw.githubusercontent.com/chayprabs/localtools/main/html-extractor/install.sh | bashlocaltools-html-extractor updatelocaltools-html-extractor uninstall
brew install chayprabs/localtools/localtools-html-extractorbrew upgrade localtools-html-extractorbrew uninstall localtools-html-extractor
scoop bucket add localtools https://github.com/chayprabs/homebrew-localtools; scoop install localtools-html-extractorscoop update localtools-html-extractorscoop uninstall localtools-html-extractor
winget install localtools.HtmlExtractorwinget upgrade localtools.HtmlExtractorwinget uninstall localtools.HtmlExtractor
Opens at http://127.0.0.1:47120 in your browser. Run localtools-html-extractor --help for the command line. Set LOCALTOOLS_NO_OPEN=1 to install without opening it.
Direct download
| Platform | File | Size |
|---|---|---|
| Windows x64 | html-extractor-1.0.3-windows-x64.zip | 3.6 MB |
| macOS Apple Silicon | html-extractor-1.0.3-macos-arm64.zip | 3.3 MB |
| macOS Intel | html-extractor-1.0.3-macos-x64.zip | 3.6 MB |
| Linux x64 | html-extractor-1.0.3-linux-x64.zip | 3.5 MB |
| Linux ARM64 | html-extractor-1.0.3-linux-arm64.zip | 3.2 MB |
SHA-256 checksums are in the release notes; the install scripts verify them for you.
See it
How to use
- Open HTML Extractor (it starts at http://127.0.0.1:47120).
- Paste HTML or choose a saved .html file.
- Enter a row selector, e.g. article or tr: one result row per match.
- Edit the field map: a name, a CSS selector inside the row, and optionally an attribute such as href.
- Press Extract, then copy or download the JSON or CSV.
- From a terminal: localtools-html-extractor extract --rows article --fields fields.json --format csv page.html > out.csv
FAQ
Can it fetch a live URL or run the page's JavaScript?
No. It works on HTML you paste or save, entirely offline. Save the page from your browser (or with curl) first; content built by JavaScript must be saved after it has rendered.
Which CSS selectors are supported?
The Cascadia selector set used by goquery: type, class, id, attribute, combinators, :nth-child, :not, :has, :contains and more. An unsupported selector is reported as an error instead of silently matching nothing.
What happens with broken HTML?
It is repaired the way browsers do, using Go's HTML5 parser, so unclosed tags and missing tbody elements behave as in a browser. Declared legacy encodings such as windows-1252 or Shift_JIS are decoded.
Will large numeric IDs be rounded?
No. Every value is returned as a string, so an ID like 9007199254740993 stays exact in both JSON and CSV.
How big can the input be?
Up to 4 MiB of HTML, 5,000 rows and 20 fields per run, with a 10-second limit. Larger inputs are rejected with a clear message instead of hanging.