htmlq
htmlq copied to clipboard
[Feature] Change element's content
curl --silent https://www.rust-lang.org/ | htmlq '#get-help = "<content></content>"'
should return the whole HTML but with the changed part; just like jq.
But it outputs:
thread 'main' panicked at 'Failed to parse CSS selector: ()', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/htmlq-0.3.0/src/main.rs:218:10 note: run with
RUST_BACKTRACE=1
environment variable to display a backtrace
+1 for this. I really need the ability to use HTMLQ as a sort of stream editor, piece by piece taking unwanted elements away from some HTML, and converting others, before ultimately converting to formatted text at the end.
For example I have thousands of pages with dozens of span
s on each. In every 12th-15th span
, there is an H3
element. I don't want the content of that H3
, but I do want to convert it to a <br>
, or an:
<pre>
</pre>