htmlq icon indicating copy to clipboard operation
htmlq copied to clipboard

[Feature] Change element's content

Open danimesq opened this issue 2 years ago • 1 comments

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

danimesq avatar Dec 02 '21 17:12 danimesq

+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 spans 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>&nbsp;, or an:

<pre>

  </pre>

XLTechie avatar Aug 25 '22 06:08 XLTechie