Skip to content

Easonzero/sthe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STHE

A library to provide an easy way to extract data from HTML.

Example

// build extract option by toml
let opt: ExtractOpt = toml::from_str(r#"
  target = "href"
  selector = "a"
"#).unwrap();

// extract
let extract = extract_fragment("<a href=\"www.xxx.com\">", &opt.compile().unwrap());

// serialize result
let extract_value = toml::Value::try_from(extract).unwrap();
let expect_value = toml::from_str("text = \"www.xxx.com\"").unwrap();

assert_eq!(extract_value, expect_value);

see also examples/crawler.rs, run by cargo run --example crawler -- -c examples/opt.toml.

About

A library to provide an easy way to extract data from HTML.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors