Crates.io | jsdom |
lib.rs | jsdom |
version | 0.0.11-alpha.1 |
source | src |
created_at | 2023-05-14 18:35:30.572741 |
updated_at | 2023-06-14 20:45:25.00202 |
description | A rust javascript dom parser for web scraping |
homepage | |
repository | https://github.com/a11ywatch/jsdom |
max_upload_size | |
id | 864411 |
size | 14,399 |
A fast javascript dom parser for rust built for web scraping.
cargo add jsdom
use std::collections::HashSet;
use jsdom::extract::extract_links;
const SCRIPT: &str = r###"
var ele = document.createElement('a');
ele.href = 'https://a11ywatch.com';
"###;
#[test]
fn parse_links() {
// build tree with elements created from the nodes todo
let links: HashSet<String> = extract_links(SCRIPT);
assert!(links.contains("https://a11ywatch.com"))
}
This package will rollout features that are most important for web scraping first.
hashbrown
: Enable the hashbrown crate.tokio
: Enable tokio streaming utils.Intro stage can handle elements created in statements and expressions.