https://github.com/mgdm/htmlq
Skip to content
Sign up
* Why GitHub?
Features -
+ Mobile -
+ Actions -
+ Codespaces -
+ Packages -
+ Security -
+ Code review -
+ Issues -
+ Integrations -
+ GitHub Sponsors -
+ Customer stories-
* Team
* Enterprise
* Explore
+ Explore GitHub -
Learn and contribute
+ Topics -
+ Collections -
+ Trending -
+ Learning Lab -
+ Open source guides -
Connect with others
+ The ReadME Project -
+ Events -
+ Community forum -
+ GitHub Education -
+ GitHub Stars program -
* Marketplace
* Pricing
Plans -
+ Compare plans -
+ Contact Sales -
+ Education -
[ ]
*
#
In this repository All GitHub |
Jump to |
* No suggested jump to results
*
#
In this repository All GitHub |
Jump to |
*
#
In this user All GitHub |
Jump to |
*
#
In this repository All GitHub |
Jump to |
Sign in
Sign up
{{ message }}
mgdm / htmlq
* Notifications
* Star 2.1k
* Fork 29
Like jq, but for HTML.
MIT License
2.1k stars 29 forks
Star
Notifications
* Code
* Issues 5
* Pull requests 2
* Actions
* Projects 0
* Wiki
* Security
* Insights
More
* Code
* Issues
* Pull requests
* Actions
* Projects
* Wiki
* Security
* Insights
master
Switch branches/tags
[ ]
Branches Tags
Could not load branches
Nothing to show
{{ refName }} default View all branches
Could not load tags
Nothing to show
{{ refName }} default
View all tags
1 branch 1 tag
Code
*
Clone
HTTPS GitHub CLI
[https://github.com/m]
Use Git or checkout with SVN using the web URL.
[gh repo clone mgdm/h]
Work fast with our official CLI. Learn more.
* Open with GitHub Desktop
* Download ZIP
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Go back
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Go back
Launching Xcode
If nothing happens, download Xcode and try again.
Go back
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
@mgdm
mgdm Bump version to 0.2.0 due to default selector change
...
5cae41f Sep 7, 2021
Bump version to 0.2.0 due to default selector change
5cae41f
Git stats
* 22 commits
Files
Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
.github/workflows
add a binary build github workflow (#7)
Sep 7, 2021
src
Bump version to 0.2.0 due to default selector change
Sep 7, 2021
.gitignore
Initial commit
May 7, 2019
Cargo.lock
Bump version to 0.2.0 due to default selector change
Sep 7, 2021
Cargo.toml
Bump version to 0.2.0 due to default selector change
Sep 7, 2021
LICENSE.md
Create LICENSE.md
May 7, 2019
README.md
Bump version to 0.2.0 due to default selector change
Sep 7, 2021
View code
[ ]
htmlq Installation Usage Examples Using with cURL to find part of a
page by ID Find all the links in a page Get the text content of a
post Pretty print HTML
README.md
htmlq
Like jq, but for HTML. Uses CSS selectors to extract bits of content
from HTML files. Mozilla's MDN has a good reference for CSS selector
syntax.
Installation
cargo install htmlq
Usage
$ htmlq -h
htmlq 0.2.0
Runs CSS selectors on HTML
USAGE:
htmlq [FLAGS] [OPTIONS] ...
FLAGS:
-h, --help Prints help information
-w, --ignore-whitespace When printing text nodes, ignore those that consist entirely of whitespace
-p, --pretty Pretty-print the serialised output
-t, --text Output only the contents of text nodes inside selected elements
-V, --version Prints version information
OPTIONS:
-a, --attribute Only return this attribute (if present) from selected elements
-f, --filename The input file. Defaults to stdin
-o, --output The output file. Defaults to stdout
ARGS:
... The CSS expression to select
$
Examples
Using with cURL to find part of a page by ID
$ curl --silent https://www.rust-lang.org/ | htmlq '#get-help'