Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Change element's content #36

Open
danimesq opened this issue Dec 2, 2021 · 1 comment
Open

[Feature] Change element's content #36

danimesq opened this issue Dec 2, 2021 · 1 comment

Comments

@danimesq
Copy link

danimesq commented Dec 2, 2021

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

@XLTechie
Copy link

+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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants