utkarshkukreti / select.rs

A Rust library to extract useful data from HTML documents, suitable for web scraping.
MIT License
971 stars 69 forks source link

Allow for converting a Document back to String #70

Open cook-f opened 2 years ago

cook-f commented 2 years ago

Haven't found a convenient way to do this yet I'm afraid, would be much appreciated

Eloitor commented 2 years ago

I'm also interested in this. I tried to strip comments of an html file, and I don't know how to turn the internal representation back to a String. Here is what I tried:

let _doc = Document::from_read(html.as_bytes())?;
let _find_nodes = _doc.find(Not(Comment));
let _iter_nodes = _find_nodes.into_selection().into_iter();