visdom 0.4.11

A html document syntax and operation library, use APIs similar to jquery, easy to use for web scraping and confused html.
Documentation

Visdom

Build Status crates.io tag codecov Crates download GitHub license

API Document     Online Demos     Performance     中文 API 文档     更新文档

It's not only helpful for the working with html scraping, but also have useful APIs to mutate text nodes, so you can use it for mixing your html with dirty html fragement, and keep the web scrapers away. :sparkling_heart:

Usage

use visdom::Vis;
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>>{
  let html = r##"
    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8" />
      </head>
      <body>
        <nav id="header">
          <ul>
            <li>Hello,</li>
            <li>Vis</li>
            <li>Dom</li>
          </ul>
        </nav>
      </body>
    </html>
  "##;
  // load html
  let root = Vis::load(html)?;
  let lis = root.find("#header li");
  let lis_text = lis.text();
  println!("{}", lis_text);
  // will output "Hello,VisDom"
  Ok(())
}

Try it online

Depedencies

Questions & Advices & Bugs?

Welcome to report Issue to us if you have any question or bug or good advice.

License

MIT License.