Delight in jq, nonetheless for HTML. Makes exercise of CSS selectors to extract bits bellow material from HTML files. Mozilla’s MDN has an real reference for CSS selector syntax.
Utilization
Examples
The exercise of with cURL to acquire portion of a page by ID
“>
$ curl -s https://www.rust-lang.org/ | htmlq '#win-back' <div class="four columns mt3 mt0-l" id="get-help"> <h4>Get back!</h4> <ul> <li>"https://doc.rust-lang.org">Documentation</a>> <li>"https://users.rust-lang.org">Demand a Demand on the Users Forum</a>> <li>"http://ping.rust-lang.org">Test Web net page Location</a>> </ul> <div class="languages"> <label class="hidden" for="language-footer">Language</label> <select id="language-footer"> <option title="English (US)" value="en-US">English (en-US)</option> <option title="French" value="fr">Français (fr)</option> <option title="German" value="de">Deutsch (de)</option> </select> </div> </div>
Procure your total hyperlinks in a page
$ curl -s https://www.rust-lang.org/ | htmlq -a href a
/
/tools/set up
/be taught
/tools
/governance
/neighborhood
https://blog.rust-lang.org/
/be taught/win-started
https://blog.rust-lang.org/2019/04/25/Rust-1.34.1.html
https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html
[...]
$
Get the textual bellow material bellow material of a post
$ curl -s https://nixos.org/nixos/about.html | htmlq -t .significant
About NixOS
NixOS is a GNU/Linux distribution that goals to
enhance the articulate-of-the-art work in intention configuration management. In
present distributions, actions resembling upgrades are unpleasant:
upgrading a equipment can articulate off other capabilities to destroy, upgrading an
total intention is device less legitimate than reinstalling from scratch,
you would’t safely test what the outcomes of a configuration exchange will
be, you can not without enlighten undo changes to the intention, and plenty others. We favor
to change that. NixOS has many modern components:
[...]
Moderately print HTML
(That is a diminutive of a piece in progress)
I write about…
-
Debugging network connections on macOS with nettop
Using nettop to find out what network connections a program is trying to make.
[…]
“>
$ curl -s https://mgdm.secure | htmlq -p '#posts'
I write about...
-
Debugging network connections on macOS with nettop
The exercise of nettop to discover what network connections a program is making an are attempting to realize.
[...]