Questions tagged [kuchiki]

Kuchiki is a Rust library that lets a client traverse and manipulate XML and HTML trees. It uses html5ever as parser.

5 questions
3
votes
0 answers

How to get an HTML tag as 2 strings (opening tag, closing tag), without its contents from kuchiki?

I am writing an HTML to Markdown converter in Rust, using Kuchiki to get access to the parsed tree from html5ever. For unknown HTML tags, I want to provide the possibility to ignore them and pass them through to the output string, but still…
user1115652
2
votes
1 answer

How to get all text of a HTML document (except script/style/noscript tags) using Kuchiki?

I'm trying to get all the text on a HTML page, except for non-visible text (example: I don't want text inside script/style/noscript tags). Here's what I've come up with so far: let parser = kuchiki::parse_html().one(content); for child in…
Foobar
  • 7,458
  • 16
  • 81
  • 161
2
votes
1 answer

'expected slice, found u8' error when parsing bytes with Kuchiki

I'm running into a type error when trying to do the following: use kuchiki::parse_html; use kuchiki::traits::*; fn main() { let data = r#" test …
ocliwt
  • 23
  • 3
2
votes
1 answer

How to get only TEXT_NODE with kuchiki

I have this example HTML which I want to parse with kuchiki: @Bananowy I want only Bananowy without @. A similar question for JavaScript: How to get the text node of an element?
rofrol
  • 14,438
  • 7
  • 79
  • 77
0
votes
1 answer

Capture of moved value that cannot be copied

I'm using Kuchiki to parse some HTML and making HTTP requests using hyper to concurrently operate on results through scoped_threadpool. I select and iterate over listings. I decide the number of threads to allocate in the threadpool based on the…
Explosion Pills
  • 188,624
  • 52
  • 326
  • 405