1
Fork 0
Extract HTML using CSS selectors in the command-line. https://crates.io/crates/select-html
Go to file
Bauke 9aab3f5132
Initial commit! 🚀
2022-09-05 14:24:49 +02:00
source Initial commit! 🚀 2022-09-05 14:24:49 +02:00
tests Initial commit! 🚀 2022-09-05 14:24:49 +02:00
.gitignore Initial commit! 🚀 2022-09-05 14:24:49 +02:00
Cargo.lock Initial commit! 🚀 2022-09-05 14:24:49 +02:00
Cargo.toml Initial commit! 🚀 2022-09-05 14:24:49 +02:00
LICENSE Initial commit! 🚀 2022-09-05 14:24:49 +02:00
Makefile.toml Initial commit! 🚀 2022-09-05 14:24:49 +02:00
README.md Initial commit! 🚀 2022-09-05 14:24:49 +02:00
rustfmt.toml Initial commit! 🚀 2022-09-05 14:24:49 +02:00

README.md

select-html

A command-line tool to extract HTML using CSS selectors.

AGPL-3.0-or-later

# Use stdin to pipe HTML to select-html.
curl -s https://example.org | select-html

# Or use `--file`.
select-html --file 'example.html'

# Select and output HTML.
select-html 'title'

# Output only the inner text of selected elements.
select-html '.example' --text

# Output attribute values.
select-html '[property^="og:"]' -a 'property' -a 'content'

Installation

You can download a precompiled executable from the GitHub Releases page, or install via crates.io (cargo install select-html).

--help

USAGE:
    select-html [OPTIONS] <SELECTOR>

ARGS:
    <SELECTOR>    The CSS selector to use

OPTIONS:
    -a, --attribute <ATTRIBUTE>    Output the attribute's value from the selected element, can be
                                   used multiple times
        --file <FILE>              A HTML file to read, if not specified stdin will be used instead
    -h, --help                     Print help information
    -t, --text                     Output inner text of the selected elements
        --trim                     Trim whitespace from selected items
    -V, --version                  Print version information