@xberg-io/crawlberg-wasm 0.0.1 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +168 -2
- package/package.json +34 -6
- package/pkg/bundler/LICENSE +21 -0
- package/pkg/bundler/README.md +169 -0
- package/pkg/bundler/crawlberg_wasm.d.ts +968 -0
- package/pkg/bundler/crawlberg_wasm.js +9 -0
- package/pkg/bundler/crawlberg_wasm_bg.js +8360 -0
- package/pkg/bundler/crawlberg_wasm_bg.wasm +0 -0
- package/pkg/bundler/crawlberg_wasm_bg.wasm.d.ts +700 -0
- package/pkg/bundler/package.json +29 -0
- package/pkg/deno/LICENSE +21 -0
- package/pkg/deno/README.md +169 -0
- package/pkg/deno/crawlberg_wasm.d.ts +968 -0
- package/pkg/deno/crawlberg_wasm.js +8353 -0
- package/pkg/deno/crawlberg_wasm_bg.wasm +0 -0
- package/pkg/deno/crawlberg_wasm_bg.wasm.d.ts +700 -0
- package/pkg/nodejs/LICENSE +21 -0
- package/pkg/nodejs/README.md +169 -0
- package/pkg/nodejs/crawlberg_wasm.d.ts +968 -0
- package/pkg/nodejs/crawlberg_wasm.js +8418 -0
- package/pkg/nodejs/crawlberg_wasm_bg.wasm +0 -0
- package/pkg/nodejs/crawlberg_wasm_bg.wasm.d.ts +700 -0
- package/pkg/nodejs/package.json +23 -0
- package/pkg/web/LICENSE +21 -0
- package/pkg/web/README.md +169 -0
- package/pkg/web/crawlberg_wasm.d.ts +1693 -0
- package/pkg/web/crawlberg_wasm.js +8461 -0
- package/pkg/web/crawlberg_wasm_bg.wasm +0 -0
- package/pkg/web/crawlberg_wasm_bg.wasm.d.ts +700 -0
- package/pkg/web/package.json +27 -0
- package/index.js +0 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Kreuzberg, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,169 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/xberg-io/assets@v1/banner/readme-banner-dark.svg">
|
|
4
|
+
<img alt="Xberg" width="420" src="https://cdn.jsdelivr.net/gh/xberg-io/assets@v1/banner/readme-banner-light.svg">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
# crawlberg
|
|
9
|
+
|
|
10
|
+
<div align="center" style="display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 20px 0;">
|
|
11
|
+
<a href="https://github.com/xberg-io/alef">
|
|
12
|
+
<img src="https://img.shields.io/badge/Bindings-alef%20%D7%90-007ec6" alt="Bindings">
|
|
13
|
+
</a>
|
|
14
|
+
<!-- Language Bindings -->
|
|
15
|
+
<a href="https://crates.io/crates/crawlberg">
|
|
16
|
+
<img src="https://img.shields.io/crates/v/crawlberg?label=Rust&color=007ec6" alt="Rust">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://pypi.org/project/crawlberg/">
|
|
19
|
+
<img src="https://img.shields.io/pypi/v/crawlberg?label=Python&color=007ec6" alt="Python">
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://www.npmjs.com/package/@xberg-io/crawlberg">
|
|
22
|
+
<img src="https://img.shields.io/npm/v/@xberg-io/crawlberg?label=Node.js&color=007ec6" alt="Node.js">
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://www.npmjs.com/package/@xberg-io/crawlberg-wasm">
|
|
25
|
+
<img src="https://img.shields.io/npm/v/@xberg-io/crawlberg-wasm?label=WASM&color=007ec6" alt="WASM">
|
|
26
|
+
</a>
|
|
27
|
+
<a href="https://central.sonatype.com/artifact/io.xberg.crawlberg/crawlberg">
|
|
28
|
+
<img src="https://img.shields.io/maven-central/v/io.xberg.crawlberg/crawlberg?label=Java&color=007ec6" alt="Java">
|
|
29
|
+
</a>
|
|
30
|
+
<a href="https://pkg.go.dev/github.com/xberg-io/crawlberg/packages/go">
|
|
31
|
+
<img src="https://img.shields.io/github/v/tag/xberg-io/crawlberg?label=Go&color=007ec6" alt="Go">
|
|
32
|
+
</a>
|
|
33
|
+
<a href="https://www.nuget.org/packages/XbergIo.Crawlberg/">
|
|
34
|
+
<img src="https://img.shields.io/nuget/v/XbergIo.Crawlberg?label=C%23&color=007ec6" alt="C#">
|
|
35
|
+
</a>
|
|
36
|
+
<a href="https://packagist.org/packages/xberg-io/crawlberg">
|
|
37
|
+
<img src="https://img.shields.io/packagist/v/xberg-io/crawlberg?label=PHP&color=007ec6" alt="PHP">
|
|
38
|
+
</a>
|
|
39
|
+
<a href="https://rubygems.org/gems/crawlberg">
|
|
40
|
+
<img src="https://img.shields.io/gem/v/crawlberg?label=Ruby&color=007ec6" alt="Ruby">
|
|
41
|
+
</a>
|
|
42
|
+
<a href="https://hex.pm/packages/crawlberg">
|
|
43
|
+
<img src="https://img.shields.io/hexpm/v/crawlberg?label=Elixir&color=007ec6" alt="Elixir">
|
|
44
|
+
</a>
|
|
45
|
+
<a href="https://pub.dev/packages/crawlberg">
|
|
46
|
+
<img src="https://img.shields.io/pub/v/crawlberg?label=Dart&color=007ec6" alt="Dart">
|
|
47
|
+
</a>
|
|
48
|
+
<a href="https://central.sonatype.com/artifact/io.xberg.crawlberg.android/crawlberg-android">
|
|
49
|
+
<img src="https://img.shields.io/maven-central/v/io.xberg.crawlberg.android/crawlberg-android?label=Kotlin&color=007ec6" alt="Kotlin">
|
|
50
|
+
</a>
|
|
51
|
+
<a href="https://github.com/xberg-io/crawlberg/tree/main/packages/swift">
|
|
52
|
+
<img src="https://img.shields.io/badge/Swift-SPM-007ec6" alt="Swift">
|
|
53
|
+
</a>
|
|
54
|
+
<a href="https://github.com/xberg-io/crawlberg/tree/main/packages/zig">
|
|
55
|
+
<img src="https://img.shields.io/badge/Zig-package-007ec6" alt="Zig">
|
|
56
|
+
</a>
|
|
57
|
+
<a href="https://github.com/xberg-io/crawlberg/releases">
|
|
58
|
+
<img src="https://img.shields.io/badge/C-FFI-007ec6" alt="C FFI">
|
|
59
|
+
</a>
|
|
60
|
+
<a href="https://github.com/xberg-io/crawlberg/pkgs/container/crawlberg">
|
|
61
|
+
<img src="https://img.shields.io/badge/Docker-ghcr.io-007ec6?logo=docker&logoColor=white" alt="Docker">
|
|
62
|
+
</a>
|
|
63
|
+
|
|
64
|
+
<!-- Project Info -->
|
|
65
|
+
<a href="https://github.com/xberg-io/crawlberg/blob/main/LICENSE">
|
|
66
|
+
<img src="https://img.shields.io/badge/License-MIT-007ec6" alt="License">
|
|
67
|
+
</a>
|
|
68
|
+
<a href="https://docs.crawlberg.xberg.io">
|
|
69
|
+
<img src="https://img.shields.io/badge/Docs-crawlberg-007ec6" alt="Documentation">
|
|
70
|
+
</a>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div align="center" style="display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 28px 0 24px;">
|
|
74
|
+
<a href="https://discord.gg/xt9WY3GnKR">
|
|
75
|
+
<img height="22" src="https://img.shields.io/badge/Discord-Chat-007ec6?logo=discord&logoColor=white" alt="Join Discord">
|
|
76
|
+
</a>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
WebAssembly bindings for **crawlberg** — a high-performance Rust web crawling engine. Built with
|
|
80
|
+
wasm-bindgen for use in browsers and Node.js. Single-threaded; features requiring `std::thread`
|
|
81
|
+
are not available.
|
|
82
|
+
|
|
83
|
+
## What This Package Provides
|
|
84
|
+
|
|
85
|
+
- **Same crawler as every binding** — one Rust engine behind Python, Node.js, Ruby, Go, Java, .NET, PHP, Elixir, Dart, Kotlin Android, Swift, Zig, WASM, and C FFI.
|
|
86
|
+
- **Structured scrape output** — HTML, Markdown, metadata, links, assets, response headers, and extraction warnings with consistent field names.
|
|
87
|
+
- **Crawl controls** — depth, page limits, concurrency, URL filters, robots/sitemap handling, rate limits, and partial failure reporting.
|
|
88
|
+
- **Rendering path** — optional browser rendering for JavaScript-heavy pages; direct HTTP path for fast static pages.
|
|
89
|
+
- **WASM package** — browser and edge-compatible binding for environments where native libraries are unavailable.
|
|
90
|
+
|
|
91
|
+
## Installation
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pnpm add @xberg-io/crawlberg-wasm
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Agent plugin
|
|
98
|
+
|
|
99
|
+
The `crawlberg` plugin is available via the `xberg-io/plugins` marketplace.
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
/plugin marketplace add xberg-io/plugins
|
|
103
|
+
/plugin install crawlberg@xberg
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Works with Claude Code, Codex, Cursor, Gemini CLI, Factory Droid, GitHub Copilot CLI, and opencode. See [the marketplace README](https://github.com/xberg-io/plugins) for harness-specific install instructions.
|
|
107
|
+
|
|
108
|
+
## Quick Start
|
|
109
|
+
|
|
110
|
+
```javascript title="WASM"
|
|
111
|
+
import { CrawlConfig, crawl, createEngine, scrape } from "@xberg-io/crawlberg-wasm";
|
|
112
|
+
|
|
113
|
+
async function main() {
|
|
114
|
+
// Simplest case: scrape a single page with default settings.
|
|
115
|
+
const engine = createEngine();
|
|
116
|
+
const result = await scrape(engine, "https://example.com/");
|
|
117
|
+
console.log(`Title: ${result.metadata?.title ?? ""}`);
|
|
118
|
+
console.log(`Status: ${result.statusCode}`);
|
|
119
|
+
console.log(`Links found: ${result.links?.length ?? 0}`);
|
|
120
|
+
|
|
121
|
+
// Crawl from a seed URL, limited to one hop and a handful of pages.
|
|
122
|
+
const config = new CrawlConfig();
|
|
123
|
+
config.maxDepth = 1;
|
|
124
|
+
config.maxPages = 5;
|
|
125
|
+
const crawlEngine = createEngine(config);
|
|
126
|
+
const crawlResult = await crawl(crawlEngine, "https://en.wikipedia.org/wiki/Web_scraping");
|
|
127
|
+
console.log(`Pages crawled: ${crawlResult.pages?.length ?? 0}`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
main().catch((error) => console.error(error));
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## API Reference
|
|
134
|
+
|
|
135
|
+
Full API documentation is available at [docs.crawlberg.xberg.io](https://docs.crawlberg.xberg.io).
|
|
136
|
+
|
|
137
|
+
Key functions:
|
|
138
|
+
|
|
139
|
+
- `create_engine(config?)` — Create a crawl engine with optional configuration
|
|
140
|
+
- `scrape(engine, url)` — Scrape a single URL
|
|
141
|
+
- `crawl(engine, url)` — Crawl a website following links
|
|
142
|
+
- `map_urls(engine, url)` — Discover all pages on a site
|
|
143
|
+
- `batch_scrape(engine, urls)` — Scrape multiple URLs concurrently
|
|
144
|
+
- `batch_crawl(engine, urls)` — Crawl multiple seed URLs concurrently
|
|
145
|
+
|
|
146
|
+
## Contributing
|
|
147
|
+
|
|
148
|
+
Contributions are welcome! Please see our [Contributing Guide](https://github.com/xberg-io/crawlberg/blob/main/CONTRIBUTING.md) for details.
|
|
149
|
+
|
|
150
|
+
## Part of Xberg.dev
|
|
151
|
+
|
|
152
|
+
- [Xberg](https://github.com/xberg-io/xberg) — document intelligence: text, tables, metadata from 91+ formats with optional OCR.
|
|
153
|
+
- [Xberg Enterprise](https://github.com/xberg-io/xberg-enterprise) — managed extraction API with SDKs, dashboards, and observability.
|
|
154
|
+
- [crawlberg](https://github.com/xberg-io/crawlberg) — web crawling and scraping with HTML→Markdown and headless-Chrome fallback.
|
|
155
|
+
- [html-to-markdown](https://github.com/xberg-io/html-to-markdown) — fast, lossless HTML→Markdown engine.
|
|
156
|
+
- [liter-llm](https://github.com/xberg-io/liter-llm) — universal LLM API client with native bindings for 14 languages and 143 providers.
|
|
157
|
+
- [tree-sitter-language-pack](https://github.com/xberg-io/tree-sitter-language-pack) — tree-sitter grammars and code-intelligence primitives.
|
|
158
|
+
- [alef](https://github.com/xberg-io/alef) — the polyglot binding generator that produces every per-language binding across the 5 polyglot repos.
|
|
159
|
+
- [Discord](https://discord.gg/xt9WY3GnKR) — community, roadmap, announcements.
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
This project is licensed under [MIT License](https://github.com/xberg-io/crawlberg/blob/main/LICENSE).
|
|
164
|
+
|
|
165
|
+
## Links
|
|
166
|
+
|
|
167
|
+
- [Documentation](https://docs.crawlberg.xberg.io)
|
|
168
|
+
- [GitHub Repository](https://github.com/xberg-io/crawlberg)
|
|
169
|
+
- [Issue Tracker](https://github.com/xberg-io/crawlberg/issues)
|
package/package.json
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xberg-io/crawlberg-wasm",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.0-rc.2",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "High-performance web crawling engine",
|
|
5
6
|
"license": "MIT",
|
|
6
|
-
"repository": {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/xberg-io/crawlberg",
|
|
10
|
+
"directory": "crates/crawlberg-wasm"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"files": [
|
|
17
|
+
"pkg",
|
|
18
|
+
"*.wasm",
|
|
19
|
+
"*.d.ts",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"main": "pkg/nodejs/crawlberg_wasm.js",
|
|
23
|
+
"module": "pkg/web/crawlberg_wasm.js",
|
|
24
|
+
"types": "pkg/nodejs/crawlberg_wasm.d.ts",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "wasm-pack build --target nodejs --out-dir pkg/nodejs",
|
|
27
|
+
"build:ci": "wasm-pack build --release --target nodejs --out-dir pkg/nodejs",
|
|
28
|
+
"build:wasm:web": "wasm-pack build --release --target web --out-dir pkg/web",
|
|
29
|
+
"build:wasm:bundler": "wasm-pack build --release --target bundler --out-dir pkg/bundler",
|
|
30
|
+
"build:wasm:nodejs": "wasm-pack build --release --target nodejs --out-dir pkg/nodejs",
|
|
31
|
+
"build:wasm:deno": "wasm-pack build --release --target deno --out-dir pkg/deno",
|
|
32
|
+
"build:all": "npm run build:wasm:web && npm run build:wasm:bundler && npm run build:wasm:nodejs && npm run build:wasm:deno && find pkg -name .gitignore -delete",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"test:watch": "vitest watch",
|
|
35
|
+
"test:coverage": "vitest run --coverage",
|
|
36
|
+
"clean": "rm -rf pkg dist"
|
|
37
|
+
}
|
|
10
38
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Kreuzberg, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/xberg-io/assets@v1/banner/readme-banner-dark.svg">
|
|
4
|
+
<img alt="Xberg" width="420" src="https://cdn.jsdelivr.net/gh/xberg-io/assets@v1/banner/readme-banner-light.svg">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
# crawlberg
|
|
9
|
+
|
|
10
|
+
<div align="center" style="display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 20px 0;">
|
|
11
|
+
<a href="https://github.com/xberg-io/alef">
|
|
12
|
+
<img src="https://img.shields.io/badge/Bindings-alef%20%D7%90-007ec6" alt="Bindings">
|
|
13
|
+
</a>
|
|
14
|
+
<!-- Language Bindings -->
|
|
15
|
+
<a href="https://crates.io/crates/crawlberg">
|
|
16
|
+
<img src="https://img.shields.io/crates/v/crawlberg?label=Rust&color=007ec6" alt="Rust">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://pypi.org/project/crawlberg/">
|
|
19
|
+
<img src="https://img.shields.io/pypi/v/crawlberg?label=Python&color=007ec6" alt="Python">
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://www.npmjs.com/package/@xberg-io/crawlberg">
|
|
22
|
+
<img src="https://img.shields.io/npm/v/@xberg-io/crawlberg?label=Node.js&color=007ec6" alt="Node.js">
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://www.npmjs.com/package/@xberg-io/crawlberg-wasm">
|
|
25
|
+
<img src="https://img.shields.io/npm/v/@xberg-io/crawlberg-wasm?label=WASM&color=007ec6" alt="WASM">
|
|
26
|
+
</a>
|
|
27
|
+
<a href="https://central.sonatype.com/artifact/io.xberg.crawlberg/crawlberg">
|
|
28
|
+
<img src="https://img.shields.io/maven-central/v/io.xberg.crawlberg/crawlberg?label=Java&color=007ec6" alt="Java">
|
|
29
|
+
</a>
|
|
30
|
+
<a href="https://pkg.go.dev/github.com/xberg-io/crawlberg/packages/go">
|
|
31
|
+
<img src="https://img.shields.io/github/v/tag/xberg-io/crawlberg?label=Go&color=007ec6" alt="Go">
|
|
32
|
+
</a>
|
|
33
|
+
<a href="https://www.nuget.org/packages/XbergIo.Crawlberg/">
|
|
34
|
+
<img src="https://img.shields.io/nuget/v/XbergIo.Crawlberg?label=C%23&color=007ec6" alt="C#">
|
|
35
|
+
</a>
|
|
36
|
+
<a href="https://packagist.org/packages/xberg-io/crawlberg">
|
|
37
|
+
<img src="https://img.shields.io/packagist/v/xberg-io/crawlberg?label=PHP&color=007ec6" alt="PHP">
|
|
38
|
+
</a>
|
|
39
|
+
<a href="https://rubygems.org/gems/crawlberg">
|
|
40
|
+
<img src="https://img.shields.io/gem/v/crawlberg?label=Ruby&color=007ec6" alt="Ruby">
|
|
41
|
+
</a>
|
|
42
|
+
<a href="https://hex.pm/packages/crawlberg">
|
|
43
|
+
<img src="https://img.shields.io/hexpm/v/crawlberg?label=Elixir&color=007ec6" alt="Elixir">
|
|
44
|
+
</a>
|
|
45
|
+
<a href="https://pub.dev/packages/crawlberg">
|
|
46
|
+
<img src="https://img.shields.io/pub/v/crawlberg?label=Dart&color=007ec6" alt="Dart">
|
|
47
|
+
</a>
|
|
48
|
+
<a href="https://central.sonatype.com/artifact/io.xberg.crawlberg.android/crawlberg-android">
|
|
49
|
+
<img src="https://img.shields.io/maven-central/v/io.xberg.crawlberg.android/crawlberg-android?label=Kotlin&color=007ec6" alt="Kotlin">
|
|
50
|
+
</a>
|
|
51
|
+
<a href="https://github.com/xberg-io/crawlberg/tree/main/packages/swift">
|
|
52
|
+
<img src="https://img.shields.io/badge/Swift-SPM-007ec6" alt="Swift">
|
|
53
|
+
</a>
|
|
54
|
+
<a href="https://github.com/xberg-io/crawlberg/tree/main/packages/zig">
|
|
55
|
+
<img src="https://img.shields.io/badge/Zig-package-007ec6" alt="Zig">
|
|
56
|
+
</a>
|
|
57
|
+
<a href="https://github.com/xberg-io/crawlberg/releases">
|
|
58
|
+
<img src="https://img.shields.io/badge/C-FFI-007ec6" alt="C FFI">
|
|
59
|
+
</a>
|
|
60
|
+
<a href="https://github.com/xberg-io/crawlberg/pkgs/container/crawlberg">
|
|
61
|
+
<img src="https://img.shields.io/badge/Docker-ghcr.io-007ec6?logo=docker&logoColor=white" alt="Docker">
|
|
62
|
+
</a>
|
|
63
|
+
|
|
64
|
+
<!-- Project Info -->
|
|
65
|
+
<a href="https://github.com/xberg-io/crawlberg/blob/main/LICENSE">
|
|
66
|
+
<img src="https://img.shields.io/badge/License-MIT-007ec6" alt="License">
|
|
67
|
+
</a>
|
|
68
|
+
<a href="https://docs.crawlberg.xberg.io">
|
|
69
|
+
<img src="https://img.shields.io/badge/Docs-crawlberg-007ec6" alt="Documentation">
|
|
70
|
+
</a>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div align="center" style="display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 28px 0 24px;">
|
|
74
|
+
<a href="https://discord.gg/xt9WY3GnKR">
|
|
75
|
+
<img height="22" src="https://img.shields.io/badge/Discord-Chat-007ec6?logo=discord&logoColor=white" alt="Join Discord">
|
|
76
|
+
</a>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
WebAssembly bindings for **crawlberg** — a high-performance Rust web crawling engine. Built with
|
|
80
|
+
wasm-bindgen for use in browsers and Node.js. Single-threaded; features requiring `std::thread`
|
|
81
|
+
are not available.
|
|
82
|
+
|
|
83
|
+
## What This Package Provides
|
|
84
|
+
|
|
85
|
+
- **Same crawler as every binding** — one Rust engine behind Python, Node.js, Ruby, Go, Java, .NET, PHP, Elixir, Dart, Kotlin Android, Swift, Zig, WASM, and C FFI.
|
|
86
|
+
- **Structured scrape output** — HTML, Markdown, metadata, links, assets, response headers, and extraction warnings with consistent field names.
|
|
87
|
+
- **Crawl controls** — depth, page limits, concurrency, URL filters, robots/sitemap handling, rate limits, and partial failure reporting.
|
|
88
|
+
- **Rendering path** — optional browser rendering for JavaScript-heavy pages; direct HTTP path for fast static pages.
|
|
89
|
+
- **WASM package** — browser and edge-compatible binding for environments where native libraries are unavailable.
|
|
90
|
+
|
|
91
|
+
## Installation
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pnpm add @xberg-io/crawlberg-wasm
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Agent plugin
|
|
98
|
+
|
|
99
|
+
The `crawlberg` plugin is available via the `xberg-io/plugins` marketplace.
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
/plugin marketplace add xberg-io/plugins
|
|
103
|
+
/plugin install crawlberg@xberg
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Works with Claude Code, Codex, Cursor, Gemini CLI, Factory Droid, GitHub Copilot CLI, and opencode. See [the marketplace README](https://github.com/xberg-io/plugins) for harness-specific install instructions.
|
|
107
|
+
|
|
108
|
+
## Quick Start
|
|
109
|
+
|
|
110
|
+
```javascript title="WASM"
|
|
111
|
+
import { CrawlConfig, crawl, createEngine, scrape } from "@xberg-io/crawlberg-wasm";
|
|
112
|
+
|
|
113
|
+
async function main() {
|
|
114
|
+
// Simplest case: scrape a single page with default settings.
|
|
115
|
+
const engine = createEngine();
|
|
116
|
+
const result = await scrape(engine, "https://example.com/");
|
|
117
|
+
console.log(`Title: ${result.metadata?.title ?? ""}`);
|
|
118
|
+
console.log(`Status: ${result.statusCode}`);
|
|
119
|
+
console.log(`Links found: ${result.links?.length ?? 0}`);
|
|
120
|
+
|
|
121
|
+
// Crawl from a seed URL, limited to one hop and a handful of pages.
|
|
122
|
+
const config = new CrawlConfig();
|
|
123
|
+
config.maxDepth = 1;
|
|
124
|
+
config.maxPages = 5;
|
|
125
|
+
const crawlEngine = createEngine(config);
|
|
126
|
+
const crawlResult = await crawl(crawlEngine, "https://en.wikipedia.org/wiki/Web_scraping");
|
|
127
|
+
console.log(`Pages crawled: ${crawlResult.pages?.length ?? 0}`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
main().catch((error) => console.error(error));
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## API Reference
|
|
134
|
+
|
|
135
|
+
Full API documentation is available at [docs.crawlberg.xberg.io](https://docs.crawlberg.xberg.io).
|
|
136
|
+
|
|
137
|
+
Key functions:
|
|
138
|
+
|
|
139
|
+
- `create_engine(config?)` — Create a crawl engine with optional configuration
|
|
140
|
+
- `scrape(engine, url)` — Scrape a single URL
|
|
141
|
+
- `crawl(engine, url)` — Crawl a website following links
|
|
142
|
+
- `map_urls(engine, url)` — Discover all pages on a site
|
|
143
|
+
- `batch_scrape(engine, urls)` — Scrape multiple URLs concurrently
|
|
144
|
+
- `batch_crawl(engine, urls)` — Crawl multiple seed URLs concurrently
|
|
145
|
+
|
|
146
|
+
## Contributing
|
|
147
|
+
|
|
148
|
+
Contributions are welcome! Please see our [Contributing Guide](https://github.com/xberg-io/crawlberg/blob/main/CONTRIBUTING.md) for details.
|
|
149
|
+
|
|
150
|
+
## Part of Xberg.dev
|
|
151
|
+
|
|
152
|
+
- [Xberg](https://github.com/xberg-io/xberg) — document intelligence: text, tables, metadata from 91+ formats with optional OCR.
|
|
153
|
+
- [Xberg Enterprise](https://github.com/xberg-io/xberg-enterprise) — managed extraction API with SDKs, dashboards, and observability.
|
|
154
|
+
- [crawlberg](https://github.com/xberg-io/crawlberg) — web crawling and scraping with HTML→Markdown and headless-Chrome fallback.
|
|
155
|
+
- [html-to-markdown](https://github.com/xberg-io/html-to-markdown) — fast, lossless HTML→Markdown engine.
|
|
156
|
+
- [liter-llm](https://github.com/xberg-io/liter-llm) — universal LLM API client with native bindings for 14 languages and 143 providers.
|
|
157
|
+
- [tree-sitter-language-pack](https://github.com/xberg-io/tree-sitter-language-pack) — tree-sitter grammars and code-intelligence primitives.
|
|
158
|
+
- [alef](https://github.com/xberg-io/alef) — the polyglot binding generator that produces every per-language binding across the 5 polyglot repos.
|
|
159
|
+
- [Discord](https://discord.gg/xt9WY3GnKR) — community, roadmap, announcements.
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
This project is licensed under [MIT License](https://github.com/xberg-io/crawlberg/blob/main/LICENSE).
|
|
164
|
+
|
|
165
|
+
## Links
|
|
166
|
+
|
|
167
|
+
- [Documentation](https://docs.crawlberg.xberg.io)
|
|
168
|
+
- [GitHub Repository](https://github.com/xberg-io/crawlberg)
|
|
169
|
+
- [Issue Tracker](https://github.com/xberg-io/crawlberg/issues)
|