{"id":39030023,"url":"https://github.com/bug-ops/scrape-rs","last_synced_at":"2026-02-20T20:00:38.850Z","repository":{"id":332841095,"uuid":"1135191057","full_name":"bug-ops/scrape-rs","owner":"bug-ops","description":"🦀 High-performance HTML parsing library. Rust core with native bindings for Python, Node.js \u0026 WASM. SIMD-accelerated, memory-safe, consistent API everywhere.","archived":false,"fork":false,"pushed_at":"2026-02-16T14:07:13.000Z","size":525,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-16T22:35:56.908Z","etag":null,"topics":["beautifulsoup","cheerio","css-selectors","dom-parser","html-parser","html5","python","rust","scraping","simd","wasm","web-scraping"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bug-ops.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-15T19:06:08.000Z","updated_at":"2026-02-16T14:06:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"974e6e16-bc98-4044-a552-9d7c17285726","html_url":"https://github.com/bug-ops/scrape-rs","commit_stats":null,"previous_names":["bug-ops/scrape-rs"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/bug-ops/scrape-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fscrape-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fscrape-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fscrape-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fscrape-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bug-ops","download_url":"https://codeload.github.com/bug-ops/scrape-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fscrape-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29659752,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T16:33:43.953Z","status":"ssl_error","status_checked_at":"2026-02-20T16:33:43.598Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beautifulsoup","cheerio","css-selectors","dom-parser","html-parser","html5","python","rust","scraping","simd","wasm","web-scraping"],"created_at":"2026-01-17T17:37:19.444Z","updated_at":"2026-02-20T20:00:38.845Z","avatar_url":"https://github.com/bug-ops.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fast-scrape\n\n[![CI](https://img.shields.io/github/actions/workflow/status/bug-ops/scrape-rs/ci.yml?branch=main\u0026label=CI)](https://github.com/bug-ops/scrape-rs/actions)\n[![codecov](https://codecov.io/gh/bug-ops/scrape-rs/graph/badge.svg?token=6MQTONGT95)](https://codecov.io/gh/bug-ops/scrape-rs)\n[![Crates.io](https://img.shields.io/crates/v/scrape-core)](https://crates.io/crates/scrape-core)\n[![PyPI](https://img.shields.io/pypi/v/fast-scrape)](https://pypi.org/project/fast-scrape)\n[![npm](https://img.shields.io/npm/v/@fast-scrape/node)](https://www.npmjs.com/package/@fast-scrape/node)\n[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue)](LICENSE-MIT)\n\nHigh-performance HTML parsing for Rust, Python, Node.js, and browsers. **8x faster** than BeautifulSoup4, **2x faster** than Cheerio, with **native-comparable** WASM performance.\n\n```\npip install fast-scrape          # Python\nnpm install @fast-scrape/node    # Node.js\nnpm install @fast-scrape/wasm    # Browser/WASM\ncargo add scrape-core            # Rust library\ncargo install scrape-cli         # CLI tool\n```\n\n## Quick start\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003cstrong\u003ePython\u003c/strong\u003e\u003c/summary\u003e\n\n```python\nfrom scrape_rs import Soup\n\nsoup = Soup(\"\u003chtml\u003e\u003cbody\u003e\u003cdiv class='content'\u003eHello\u003c/div\u003e\u003c/body\u003e\u003c/html\u003e\")\n\ndiv = soup.find(\"div\")\nprint(div.text)  # Hello\n\nfor el in soup.select(\"div.content\"):\n    print(el.inner_html)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eNode.js\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { Soup } from '@fast-scrape/node';\n\nconst soup = new Soup(\"\u003chtml\u003e\u003cbody\u003e\u003cdiv class='content'\u003eHello\u003c/div\u003e\u003c/body\u003e\u003c/html\u003e\");\n\nconst div = soup.find(\"div\");\nconsole.log(div.text);  // Hello\n\nfor (const el of soup.select(\"div.content\")) {\n    console.log(el.innerHTML);\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRust\u003c/strong\u003e\u003c/summary\u003e\n\n```rust\nuse scrape_core::Soup;\n\nlet soup = Soup::new(\"\u003chtml\u003e\u003cbody\u003e\u003cdiv class='content'\u003eHello\u003c/div\u003e\u003c/body\u003e\u003c/html\u003e\");\n\nlet div = soup.find(\"div\").unwrap();\nprintln!(\"{}\", div.text());  // Hello\n\nfor el in soup.select(\"div.content\") {\n    println!(\"{}\", el.inner_html());\n}\n```\n\n\u003e [!IMPORTANT]\n\u003e Requires Rust 1.88 or later.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBrowser (WASM)\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport init, { Soup } from '@fast-scrape/wasm';\n\nawait init();\n\nconst soup = new Soup(\"\u003chtml\u003e\u003cbody\u003e\u003cdiv class='content'\u003eHello\u003c/div\u003e\u003c/body\u003e\u003c/html\u003e\");\nconsole.log(soup.find(\"div\").text);  // Hello\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eCLI\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\n# Extract text from HTML file\nscrape 'h1' page.html\n\n# Extract from URL via curl\ncurl -s example.com | scrape 'title'\n\n# Output as JSON\nscrape -o json 'a[href]' page.html\n```\n\n\u003c/details\u003e\n\n## Performance\n\nComprehensive benchmarks against BeautifulSoup4, lxml, Cheerio, and other competitors:\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003cstrong\u003eParse speed comparison\u003c/strong\u003e\u003c/summary\u003e\n\n| File size | scrape-rs | Rust competitors | Python competitors | Node.js |\n|-----------|-----------|-----------------|-------------------|---------|\n| 1 KB | **11 µs** | 45-52 µs (2.1-4.7x slower) | 0.23-0.31 ms (20-28x slower) | 0.42 ms (38x slower) |\n| 100 KB | **2.96 ms** | 8.2-9.1 ms (2.8-3.1x slower) | 28.2-31.4 ms (9.5-10.6x slower) | 64.8 ms (22x slower) |\n| 1 MB | **15.5 ms** | 42-48 ms (2.7-3.1x slower) | 1031-1247 ms (66-80x slower) | 2100 ms (135x slower) |\n\n**Key results:**\n- 2-135x faster than all competitors depending on file size\n- 64 MB/s throughput on 1MB files\n- Consistent performance across file sizes\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eQuery speed comparison\u003c/strong\u003e\u003c/summary\u003e\n\n| Operation | scrape-rs | BeautifulSoup4 | Speedup |\n|-----------|-----------|----------------|---------|\n| `find(\"div\")` | 208 ns | 16 µs | **77x** |\n| `find(\".class\")` | 20 ns | 797 µs | **40,000x** |\n| `find(\"#id\")` | 20 ns | 799 µs | **40,000x** |\n| `select(\"div \u003e p\")` | 24.7 µs | 4.361 ms | **176x** |\n\n**CSS Selector dominance:**\n- Class and ID selectors: 40,000x faster (nanosecond vs microsecond scale)\n- Complex selectors: 176x faster\n- Tag matching: 77x faster\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eMemory efficiency (Peak RSS on 100MB HTML)\u003c/strong\u003e\u003c/summary\u003e\n\n| Library | Memory | Relative |\n|---------|--------|----------|\n| scrape-rs | **145 MB** | 1x baseline |\n| select.rs | 312 MB | 2.2x |\n| scraper | 389 MB | 2.7x |\n| Cheerio | 1800 MB | 12.4x |\n| lxml | 2100 MB | 14.5x |\n| BeautifulSoup4 | 3200 MB | 22x |\n\n**Result:** 14-22x more memory-efficient than Python competitors\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eCross-platform consistency\u003c/strong\u003e\u003c/summary\u003e\n\n| Platform | Parse 100KB | Query .class |\n|----------|-------------|-------------|\n| Rust | 2.96 ms | 20 ns |\n| Python (via PyO3) | 2.94 ms | 21 ns |\n| Node.js (via napi-rs) | 2.88 ms | 45 ns |\n| WASM (wasm-bindgen) | 2.10 ms | 0.3 µs |\n\nSame API, consistent performance across all platforms.\n\n\u003c/details\u003e\n\n\u003e [!IMPORTANT]\n\u003e scrape-rs is **2-135x faster** than competitors for parsing, with **40,000x speedup** for CSS selector queries.\n\n\u003e [!TIP]\n\u003e Run `cargo bench --bench comparison` to benchmark on your hardware.\n\u003e See [Performance Guide](docs/src/performance/benchmarks.md) for full analysis and reproduction instructions.\n\n## Features\n\n- **Fast** — 8x faster parsing than BeautifulSoup4, 2x faster than Cheerio, with 100-7000x query speedups\n- **Batch processing** — 3-5x speedup parsing multiple documents in parallel (Rayon work-stealing)\n- **Streaming parser** — Constant O(1) memory for large files (16 KB vs 120+ MB for 100 MB files)\n- **Cross-platform** — Rust, Python, Node.js, and browsers\n- **Consistent API** — Same interface everywhere with compile-time type safety\n- **Memory-safe** — Pure Rust core, zero unsafe code\n- **SIMD-accelerated** — Auto-detects SSE4.2, AVX2, NEON, WASM SIMD for byte scanning and selector matching\n- **Type-safe queries** — Compile-time lifecycle enforcement via typestate pattern (Building → Queryable → Sealed)\n- **Trait abstractions** — HtmlSerializer trait and ElementFilter iterators with zero-overhead abstraction\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRust feature flags\u003c/strong\u003e\u003c/summary\u003e\n\n```toml\n[dependencies]\nscrape-core = { version = \"0.2\", features = [\"simd\", \"parallel\"] }\n```\n\n| Feature | Description | Default |\n|---------|-------------|---------|\n| `simd` | SIMD-accelerated parsing | No |\n| `parallel` | Parallel batch processing via Rayon | No |\n| `streaming` | Streaming parser with constant O(1) memory | No |\n| `mmap` | Memory-mapped file support for zero-copy parsing | No |\n| `full` | Enable all features | No |\n\n\u003e [!NOTE]\n\u003e Python and Node.js bindings enable `simd` and `parallel` by default. WASM uses `simd` only (no threads). Streaming is opt-in for all platforms.\n\n\u003c/details\u003e\n\n## Architecture\n\n```mermaid\ngraph TD\n    Core[scrape-core\u003cbr\u003e\u003ci\u003ePure Rust • SIMD • Parallel\u003c/i\u003e]\n\n    Core --\u003e CLI[scrape-cli\u003cbr\u003e\u003ci\u003eCLI tool\u003c/i\u003e]\n    Core --\u003e Python[fast-scrape\u003cbr\u003e\u003ci\u003ePyO3\u003c/i\u003e]\n    Core --\u003e Node[\"@fast-scrape/node\u003cbr\u003e\u003ci\u003enapi-rs\u003c/i\u003e\"]\n    Core --\u003e WASM[\"@fast-scrape/wasm\u003cbr\u003e\u003ci\u003ewasm-bindgen\u003c/i\u003e\"]\n```\n\n### Built on Servo and Cloudflare\n\nThe core is powered by battle-tested libraries:\n\n**Parsing \u0026 Selection (Servo browser engine):**\n- [html5ever](https://crates.io/crates/html5ever) — Spec-compliant HTML5 parser\n- [selectors](https://crates.io/crates/selectors) — CSS selector matching engine\n- [cssparser](https://crates.io/crates/cssparser) — CSS parser\n\n**Streaming Parser (Cloudflare):**\n- [lol_html](https://github.com/cloudflare/lol_html) — High-performance streaming HTML parser with constant-memory event-driven API\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eProject structure\u003c/strong\u003e\u003c/summary\u003e\n\n```\ncrates/\n├── scrape-core/    # Pure Rust library\n├── scrape-cli/     # Command-line tool\n├── scrape-py/      # Python bindings (PyO3)\n├── scrape-node/    # Node.js bindings (napi-rs)\n└── scrape-wasm/    # WASM bindings (wasm-bindgen)\n```\n\n\u003c/details\u003e\n\n## Contributing\n\nContributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License\n\nMIT OR Apache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbug-ops%2Fscrape-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbug-ops%2Fscrape-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbug-ops%2Fscrape-rs/lists"}