spider-rs / jsdom

JSDOM for Rust [incomplete]

Home Page:https://crates.io/crates/jsdom

Repository from Github https://github.comspider-rs/jsdomRepository from Github https://github.comspider-rs/jsdom

jsdom

A fast javascript dom parser 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"))
}

Features

This package will rollout features that are most important for web scraping first.

  1. hashbrown: Enable the hashbrown crate.
  2. tokio: Enable tokio streaming utils.

Stage 0.1

Intro stage can handle elements created in statements and expressions.

About

JSDOM for Rust [incomplete]

https://crates.io/crates/jsdom

License:MIT License


Languages

Language:Rust 100.0%