crawlberg-cli 1.13.3__py3-none-win_amd64.whl
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.
- crawlberg_cli/__init__.py +8 -0
- crawlberg_cli/bin/x86_64-pc-windows-msvc/LICENSE +21 -0
- crawlberg_cli/bin/x86_64-pc-windows-msvc/README.md +432 -0
- crawlberg_cli/bin/x86_64-pc-windows-msvc/crawlberg.exe +4 -0
- crawlberg_cli/cli.py +45 -0
- crawlberg_cli/downloader.py +299 -0
- crawlberg_cli-1.13.3.dist-info/METADATA +32 -0
- crawlberg_cli-1.13.3.dist-info/RECORD +10 -0
- crawlberg_cli-1.13.3.dist-info/WHEEL +4 -0
- crawlberg_cli-1.13.3.dist-info/entry_points.txt +2 -0
|
@@ -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,432 @@
|
|
|
1
|
+
<!-- This file is auto-generated by alef — DO NOT EDIT. -->
|
|
2
|
+
<!-- alef:hash:555d38ed4e9419566f88eaf96eb4ad4fe7ec58920df1ce9295a7002253189815 -->
|
|
3
|
+
<!-- To regenerate: alef readme -->
|
|
4
|
+
<!-- To verify freshness: alef verify -->
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<picture>
|
|
8
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/xberg-io/assets@v1/banner/readme-banner-dark.svg">
|
|
9
|
+
<img alt="Xberg" width="420" src="https://cdn.jsdelivr.net/gh/xberg-io/assets@v1/banner/readme-banner-light.svg">
|
|
10
|
+
</picture>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
# Crawlberg
|
|
14
|
+
|
|
15
|
+
<div align="center" style="display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 20px 0;">
|
|
16
|
+
<a href="https://github.com/xberg-io/alef">
|
|
17
|
+
<img src="https://img.shields.io/badge/built%20with-alef%20%D7%90-007ec6" alt="Built with alef">
|
|
18
|
+
</a>
|
|
19
|
+
<!-- Language Bindings -->
|
|
20
|
+
<a href="https://crates.io/crates/crawlberg">
|
|
21
|
+
<img src="https://img.shields.io/crates/v/crawlberg?label=Rust&color=007ec6" alt="Rust">
|
|
22
|
+
</a>
|
|
23
|
+
<a href="https://pypi.org/project/crawlberg/">
|
|
24
|
+
<img src="https://img.shields.io/pypi/v/crawlberg?label=Python&color=007ec6" alt="Python">
|
|
25
|
+
</a>
|
|
26
|
+
<a href="https://www.npmjs.com/package/@xberg-io/crawlberg">
|
|
27
|
+
<img src="https://img.shields.io/npm/v/@xberg-io/crawlberg?label=Node.js&color=007ec6" alt="Node.js">
|
|
28
|
+
</a>
|
|
29
|
+
<a href="https://www.npmjs.com/package/@xberg-io/crawlberg-wasm">
|
|
30
|
+
<img src="https://img.shields.io/npm/v/@xberg-io/crawlberg-wasm?label=WASM&color=007ec6" alt="WASM">
|
|
31
|
+
</a>
|
|
32
|
+
<a href="https://central.sonatype.com/artifact/io.xberg.crawlberg/crawlberg">
|
|
33
|
+
<img src="https://img.shields.io/maven-central/v/io.xberg.crawlberg/crawlberg?label=Java&color=007ec6" alt="Java">
|
|
34
|
+
</a>
|
|
35
|
+
<a href="https://pkg.go.dev/github.com/xberg-io/crawlberg/packages/go">
|
|
36
|
+
<img src="https://img.shields.io/github/v/tag/xberg-io/crawlberg?label=Go&color=007ec6" alt="Go">
|
|
37
|
+
</a>
|
|
38
|
+
<a href="https://www.nuget.org/packages/XbergIo.Crawlberg/">
|
|
39
|
+
<img src="https://img.shields.io/nuget/v/XbergIo.Crawlberg?label=C%23&color=007ec6" alt="C#">
|
|
40
|
+
</a>
|
|
41
|
+
<a href="https://packagist.org/packages/xberg-io/crawlberg">
|
|
42
|
+
<img src="https://img.shields.io/packagist/v/xberg-io/crawlberg?label=PHP&color=007ec6" alt="PHP">
|
|
43
|
+
</a>
|
|
44
|
+
<a href="https://rubygems.org/gems/crawlberg">
|
|
45
|
+
<img src="https://img.shields.io/gem/v/crawlberg?label=Ruby&color=007ec6" alt="Ruby">
|
|
46
|
+
</a>
|
|
47
|
+
<a href="https://hex.pm/packages/crawlberg">
|
|
48
|
+
<img src="https://img.shields.io/hexpm/v/crawlberg?label=Elixir&color=007ec6" alt="Elixir">
|
|
49
|
+
</a>
|
|
50
|
+
<a href="https://pub.dev/packages/crawlberg">
|
|
51
|
+
<img src="https://img.shields.io/pub/v/crawlberg?label=Dart&color=007ec6" alt="Dart">
|
|
52
|
+
</a>
|
|
53
|
+
<a href="https://central.sonatype.com/artifact/io.xberg.crawlberg.android/crawlberg-android">
|
|
54
|
+
<img src="https://img.shields.io/maven-central/v/io.xberg.crawlberg.android/crawlberg-android?label=Kotlin&color=007ec6" alt="Kotlin">
|
|
55
|
+
</a>
|
|
56
|
+
<a href="https://github.com/xberg-io/crawlberg/tree/main/packages/swift">
|
|
57
|
+
<img src="https://img.shields.io/badge/Swift-SPM-007ec6" alt="Swift">
|
|
58
|
+
</a>
|
|
59
|
+
<a href="https://github.com/xberg-io/crawlberg/tree/main/packages/zig">
|
|
60
|
+
<img src="https://img.shields.io/badge/Zig-package-007ec6" alt="Zig">
|
|
61
|
+
</a>
|
|
62
|
+
<a href="https://github.com/xberg-io/crawlberg/releases">
|
|
63
|
+
<img src="https://img.shields.io/badge/C-FFI-007ec6" alt="C FFI">
|
|
64
|
+
</a>
|
|
65
|
+
<a href="https://github.com/xberg-io/crawlberg/pkgs/container/crawlberg">
|
|
66
|
+
<img src="https://img.shields.io/badge/Docker-ghcr.io-007ec6?logo=docker&logoColor=white" alt="Docker">
|
|
67
|
+
</a>
|
|
68
|
+
|
|
69
|
+
<!-- Project Info -->
|
|
70
|
+
<a href="https://github.com/xberg-io/crawlberg/blob/main/LICENSE">
|
|
71
|
+
<img src="https://img.shields.io/badge/License-MIT-007ec6" alt="License">
|
|
72
|
+
</a>
|
|
73
|
+
<a href="https://docs.crawlberg.xberg.io">
|
|
74
|
+
<img src="https://img.shields.io/badge/Docs-crawlberg-007ec6" alt="Documentation">
|
|
75
|
+
</a>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div align="center" style="display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 28px 0 24px;">
|
|
79
|
+
<a href="https://discord.gg/xt9WY3GnKR">
|
|
80
|
+
<img height="22" src="https://img.shields.io/badge/Discord-Chat-007ec6?logo=discord&logoColor=white" alt="Join Discord">
|
|
81
|
+
</a>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
Turn any website into clean, structured data. Point Crawlberg at a URL and get back Markdown, metadata, and links — from a single page or a whole site — in the language you already use.
|
|
85
|
+
|
|
86
|
+
## What and Why?
|
|
87
|
+
|
|
88
|
+
You need data that lives on the web, and raw HTML is not it. Crawlberg does the crawling, scraping, and cleanup end-to-end: it fetches pages, follows links, converts each one to Markdown, and hands you structured metadata (titles, links, images, social-card and JSON-LD data) — so you skip the parsing and go straight to the content.
|
|
89
|
+
|
|
90
|
+
It runs from a single Rust core with identical results across 14 language bindings, and it handles the awkward parts for you: JavaScript-heavy pages fall back to a real headless browser, bot filters are detected and worked around, robots and sitemaps are respected, requests are throttled per domain, and requests to private or internal addresses are refused by default. Drive it from your code, an AI agent, a REST service, or the CLI.
|
|
91
|
+
|
|
92
|
+
Every part of the pipeline is a trait you can swap — the crawl frontier, rate limiter, storage, event stream, and content filters — so you can plug in your own behavior. Managed extras like proxy pools, tuned bot-evasion, authenticated sessions, scheduling, and billing live in [Xberg Enterprise](https://pro.xberg.io).
|
|
93
|
+
|
|
94
|
+
### Features
|
|
95
|
+
|
|
96
|
+
| Feature | Description |
|
|
97
|
+
| ------- | ----------- |
|
|
98
|
+
| **Structured extraction** | Text, metadata, links, images, assets, JSON-LD, Open Graph, hreflang, favicons, headings, response headers |
|
|
99
|
+
| **Markdown conversion** | Clean Markdown with citations, document structure, and fit-content mode |
|
|
100
|
+
| **Concurrent crawling** | Depth-first, breadth-first, or best-first traversal with configurable depth, page limits, and concurrency |
|
|
101
|
+
| **14 language bindings** | Rust, Python, Node.js, Ruby, Go, Java, Kotlin (Android), C#, PHP, Elixir, Dart, Swift, Zig, and WebAssembly |
|
|
102
|
+
| **Smart filtering** | BM25 relevance scoring, URL include/exclude patterns, robots.txt compliance, sitemap discovery |
|
|
103
|
+
| **Browser rendering** | Optional headless browser for JavaScript-heavy SPAs with WAF detection and bypass |
|
|
104
|
+
| **Batch & streaming** | Scrape or crawl hundreds of URLs concurrently; real-time crawl events via async streams |
|
|
105
|
+
| **SSRF-safe by default** | Refuses loopback, private, link-local, and cloud-metadata addresses; opt out via env var or `CrawlConfig` |
|
|
106
|
+
| **Auth & rate limiting** | HTTP Basic, Bearer, and custom-header auth with cookie jars; per-domain request throttling |
|
|
107
|
+
| **MCP server & REST API** | Model Context Protocol integration for AI agents plus an HTTP server with OpenAPI spec |
|
|
108
|
+
|
|
109
|
+
### Supported Platforms
|
|
110
|
+
|
|
111
|
+
Precompiled binaries for glibc Linux (x86_64/aarch64), macOS, and Windows across every binding. On musl Linux (Alpine) coverage is deliberately partial — the CLI, Docker image, Rust, Ruby, Java, and Elixir work there; the Node, Python, Go, PHP, and C# bindings do not ship musl artifacts. See the [platform support matrix](https://docs.crawlberg.xberg.io/getting-started/installation/#platform-support) for the full table and the Alpine workarounds.
|
|
112
|
+
|
|
113
|
+
<p align="center"><strong>⭐ Star this repo to show your support — it helps others discover Crawlberg.</strong></p>
|
|
114
|
+
|
|
115
|
+
## Quick Start
|
|
116
|
+
|
|
117
|
+
### Language Packages
|
|
118
|
+
|
|
119
|
+
<details open>
|
|
120
|
+
<summary><strong>Python</strong></summary>
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
pip install crawlberg
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
See [Python README](https://github.com/xberg-io/crawlberg/tree/main/packages/python) for full documentation.
|
|
127
|
+
|
|
128
|
+
</details>
|
|
129
|
+
|
|
130
|
+
<details>
|
|
131
|
+
<summary><strong>Node.js</strong></summary>
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
pnpm add @xberg-io/crawlberg
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
See [Node.js README](https://github.com/xberg-io/crawlberg/tree/main/crates/crawlberg-node) for full documentation.
|
|
138
|
+
|
|
139
|
+
</details>
|
|
140
|
+
|
|
141
|
+
<details>
|
|
142
|
+
<summary><strong>Rust</strong></summary>
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
cargo add crawlberg
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
See [Rust README](https://github.com/xberg-io/crawlberg/tree/main/crates/crawlberg) for full documentation.
|
|
149
|
+
|
|
150
|
+
</details>
|
|
151
|
+
|
|
152
|
+
<details>
|
|
153
|
+
<summary><strong>Go</strong></summary>
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
go get github.com/xberg-io/crawlberg/packages/go
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
See [Go README](https://github.com/xberg-io/crawlberg/tree/main/packages/go) for full documentation.
|
|
160
|
+
|
|
161
|
+
</details>
|
|
162
|
+
|
|
163
|
+
<details>
|
|
164
|
+
<summary><strong>Java</strong></summary>
|
|
165
|
+
|
|
166
|
+
Available on Maven Central as `io.xberg.crawlberg:crawlberg`. See [Java README](https://github.com/xberg-io/crawlberg/tree/main/packages/java) for the dependency snippet and current version.
|
|
167
|
+
|
|
168
|
+
</details>
|
|
169
|
+
|
|
170
|
+
<details>
|
|
171
|
+
<summary><strong>C#</strong></summary>
|
|
172
|
+
|
|
173
|
+
```sh
|
|
174
|
+
dotnet add package XbergIo.Crawlberg
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
See [C# README](https://github.com/xberg-io/crawlberg/tree/main/packages/csharp) for full documentation.
|
|
178
|
+
|
|
179
|
+
</details>
|
|
180
|
+
|
|
181
|
+
<details>
|
|
182
|
+
<summary><strong>Ruby</strong></summary>
|
|
183
|
+
|
|
184
|
+
```sh
|
|
185
|
+
gem install crawlberg
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
See [Ruby README](https://github.com/xberg-io/crawlberg/tree/main/packages/ruby) for full documentation.
|
|
189
|
+
|
|
190
|
+
</details>
|
|
191
|
+
|
|
192
|
+
<details>
|
|
193
|
+
<summary><strong>PHP</strong></summary>
|
|
194
|
+
|
|
195
|
+
```sh
|
|
196
|
+
composer require xberg-io/crawlberg
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
See [PHP README](https://github.com/xberg-io/crawlberg/tree/main/packages/php) for full documentation.
|
|
200
|
+
|
|
201
|
+
</details>
|
|
202
|
+
|
|
203
|
+
<details>
|
|
204
|
+
<summary><strong>Elixir</strong></summary>
|
|
205
|
+
|
|
206
|
+
Add `{:crawlberg, "~> 0.3"}` to your `mix.exs` dependencies. See [Elixir README](https://github.com/xberg-io/crawlberg/tree/main/packages/elixir) for full documentation.
|
|
207
|
+
|
|
208
|
+
</details>
|
|
209
|
+
|
|
210
|
+
<details>
|
|
211
|
+
<summary><strong>Dart / Flutter</strong></summary>
|
|
212
|
+
|
|
213
|
+
```sh
|
|
214
|
+
dart pub add crawlberg
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
See [Dart README](https://github.com/xberg-io/crawlberg/tree/main/packages/dart) for full documentation.
|
|
218
|
+
|
|
219
|
+
</details>
|
|
220
|
+
|
|
221
|
+
<details>
|
|
222
|
+
<summary><strong>Kotlin (Android)</strong></summary>
|
|
223
|
+
|
|
224
|
+
Available on Maven Central as `io.xberg.crawlberg.android:crawlberg-android`. See [Kotlin README](https://github.com/xberg-io/crawlberg/tree/main/packages/kotlin-android) for the dependency snippet and current version.
|
|
225
|
+
|
|
226
|
+
</details>
|
|
227
|
+
|
|
228
|
+
<details>
|
|
229
|
+
<summary><strong>Swift</strong></summary>
|
|
230
|
+
|
|
231
|
+
Add via Swift Package Manager. See [Swift README](https://github.com/xberg-io/crawlberg/tree/main/packages/swift) for full documentation.
|
|
232
|
+
|
|
233
|
+
</details>
|
|
234
|
+
|
|
235
|
+
<details>
|
|
236
|
+
<summary><strong>Zig</strong></summary>
|
|
237
|
+
|
|
238
|
+
See [Zig README](https://github.com/xberg-io/crawlberg/tree/main/packages/zig) for installation and usage.
|
|
239
|
+
|
|
240
|
+
</details>
|
|
241
|
+
|
|
242
|
+
<details>
|
|
243
|
+
<summary><strong>WebAssembly</strong></summary>
|
|
244
|
+
|
|
245
|
+
```sh
|
|
246
|
+
pnpm add @xberg-io/crawlberg-wasm
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
See [WebAssembly README](https://github.com/xberg-io/crawlberg/tree/main/crates/crawlberg-wasm) for full documentation.
|
|
250
|
+
|
|
251
|
+
</details>
|
|
252
|
+
|
|
253
|
+
<details>
|
|
254
|
+
<summary><strong>C/C++ (FFI)</strong></summary>
|
|
255
|
+
|
|
256
|
+
C header + shared library from [GitHub Releases](https://github.com/xberg-io/crawlberg/releases). See [FFI crate](https://github.com/xberg-io/crawlberg/tree/main/crates/crawlberg-ffi) for full documentation.
|
|
257
|
+
|
|
258
|
+
</details>
|
|
259
|
+
|
|
260
|
+
<details>
|
|
261
|
+
<summary><strong>CLI</strong></summary>
|
|
262
|
+
|
|
263
|
+
```sh
|
|
264
|
+
cargo install crawlberg-cli
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
```sh
|
|
268
|
+
# Or install the prebuilt binary via cargo-binstall:
|
|
269
|
+
cargo binstall crawlberg-cli
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
```sh
|
|
273
|
+
brew install xberg-io/tap/crawlberg
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Windows users can install the same binary through [Scoop](https://scoop.sh):
|
|
277
|
+
|
|
278
|
+
```powershell
|
|
279
|
+
scoop bucket add xberg https://github.com/xberg-io/scoop-bucket
|
|
280
|
+
scoop install crawlberg
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
See [CLI README](https://github.com/xberg-io/crawlberg/tree/main/crates/crawlberg-cli) for full documentation.
|
|
284
|
+
|
|
285
|
+
</details>
|
|
286
|
+
|
|
287
|
+
### AI Coding Assistants
|
|
288
|
+
|
|
289
|
+
Install the Crawlberg plugin from [`xberg-io/crawlberg`](https://github.com/xberg-io/crawlberg). It ships the Crawlberg agent skills (site crawling, HTML→Markdown scraping, headless-Chrome fallback) plus the `crawlberg` MCP server, — select your runtime below.
|
|
290
|
+
|
|
291
|
+
The bundle targets Claude Code, Codex, Cursor, Gemini CLI, Kimi, OpenCode, Factory Droid,
|
|
292
|
+
Hermes, Pi, Agent Plugins and GitHub Copilot CLI. Read [the plugin guide](https://github.com/xberg-io/crawlberg/blob/main/plugin/README.md)
|
|
293
|
+
for runtime resources, CLI prerequisites and configuration. MCP-capable adapters expose the
|
|
294
|
+
product's tools; Hermes uses a local stdio bridge and explicitly selected skills. Pi loads
|
|
295
|
+
skills and prompt templates and requires the product CLI for executable operations.
|
|
296
|
+
|
|
297
|
+
Install only the public [Agent Skills](https://github.com/xberg-io/crawlberg/tree/main/skills),
|
|
298
|
+
without a plugin or MCP registration, using the [skills CLI](https://github.com/vercel-labs/skills):
|
|
299
|
+
|
|
300
|
+
```sh
|
|
301
|
+
npx skills add xberg-io/crawlberg --list
|
|
302
|
+
npx skills add xberg-io/crawlberg
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Choose the skills and target agents interactively. Installing instructions does not install the
|
|
306
|
+
product CLI or configure provider credentials.
|
|
307
|
+
|
|
308
|
+
<details open>
|
|
309
|
+
<summary><strong>Claude Code</strong></summary>
|
|
310
|
+
|
|
311
|
+
```text
|
|
312
|
+
/plugin marketplace add xberg-io/crawlberg
|
|
313
|
+
/plugin install crawlberg@crawlberg
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
</details>
|
|
317
|
+
|
|
318
|
+
<details>
|
|
319
|
+
<summary><strong>Codex CLI</strong></summary>
|
|
320
|
+
|
|
321
|
+
```text
|
|
322
|
+
/plugins add https://github.com/xberg-io/crawlberg
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Then search for `crawlberg` and select **Install Plugin**.
|
|
326
|
+
|
|
327
|
+
</details>
|
|
328
|
+
|
|
329
|
+
<details>
|
|
330
|
+
<summary><strong>Cursor</strong></summary>
|
|
331
|
+
|
|
332
|
+
Settings → Plugins → Add from URL → `https://github.com/xberg-io/crawlberg`, then select **crawlberg**.
|
|
333
|
+
|
|
334
|
+
</details>
|
|
335
|
+
|
|
336
|
+
<details>
|
|
337
|
+
<summary><strong>Gemini CLI</strong></summary>
|
|
338
|
+
|
|
339
|
+
From a checkout of this repository:
|
|
340
|
+
|
|
341
|
+
```sh
|
|
342
|
+
gemini extensions install ./plugin
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
The manifest is inside `plugin/`. See the [Gemini extension reference](https://geminicli.com/docs/extensions/reference/)
|
|
346
|
+
for local installation and updates.
|
|
347
|
+
|
|
348
|
+
</details>
|
|
349
|
+
|
|
350
|
+
<details>
|
|
351
|
+
<summary><strong>Factory Droid</strong></summary>
|
|
352
|
+
|
|
353
|
+
```text
|
|
354
|
+
droid plugin marketplace add https://github.com/xberg-io/crawlberg
|
|
355
|
+
droid plugin install crawlberg@crawlberg
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
</details>
|
|
359
|
+
|
|
360
|
+
<details>
|
|
361
|
+
<summary><strong>GitHub Copilot CLI</strong></summary>
|
|
362
|
+
|
|
363
|
+
```text
|
|
364
|
+
copilot plugin marketplace add https://github.com/xberg-io/crawlberg
|
|
365
|
+
copilot plugin install crawlberg@crawlberg
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
</details>
|
|
369
|
+
|
|
370
|
+
<details>
|
|
371
|
+
<summary><strong>Pi</strong></summary>
|
|
372
|
+
|
|
373
|
+
From a checkout of this repository:
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
pi install ./plugin
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
After the next plugin release, install the same package used by OpenCode:
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
pi install npm:@xberg-io/opencode-crawlberg
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Pi loads the bundled skills and prompt templates. Use `/crawlberg-scrape` or `/crawlberg-crawl` with the input as arguments. Install the `crawlberg` CLI separately for shell access. This package does not register MCP servers, hooks, or native Pi extensions.
|
|
386
|
+
|
|
387
|
+
</details>
|
|
388
|
+
|
|
389
|
+
<details>
|
|
390
|
+
<summary><strong>opencode</strong></summary>
|
|
391
|
+
|
|
392
|
+
Add the package to `opencode.json`:
|
|
393
|
+
|
|
394
|
+
```json
|
|
395
|
+
{
|
|
396
|
+
"$schema": "https://opencode.ai/config.json",
|
|
397
|
+
"plugin": ["@xberg-io/opencode-crawlberg"]
|
|
398
|
+
}
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
</details>
|
|
402
|
+
|
|
403
|
+
## Documentation
|
|
404
|
+
|
|
405
|
+
Full guides, per-language API references, the substrate/operational model, antibot strategy, and observability live at **[docs.crawlberg.xberg.io](https://docs.crawlberg.xberg.io)**.
|
|
406
|
+
|
|
407
|
+
## Contributing
|
|
408
|
+
|
|
409
|
+
Contributions are welcome! See our [Contributing Guide](https://github.com/xberg-io/crawlberg/blob/main/CONTRIBUTING.md).
|
|
410
|
+
|
|
411
|
+
## Part of Xberg.io
|
|
412
|
+
|
|
413
|
+
- [Xberg](https://github.com/xberg-io/xberg) — the open-source content-intelligence engine: text, tables, and metadata from 101 formats (115 file extensions), with OCR, transcription, and code intelligence. MIT.
|
|
414
|
+
- [Xberg Pro](https://pro.xberg.io) — a complete self-hosted content-intelligence backend in a single container. Commercial.
|
|
415
|
+
- [Xberg Enterprise](https://pro.xberg.io) — the distributed, governed content-intelligence platform, scaled on Kubernetes with team governance and support. Commercial.
|
|
416
|
+
- [crawlberg](https://github.com/xberg-io/crawlberg) — web crawling and scraping with HTML→Markdown and headless-Chrome fallback.
|
|
417
|
+
- [html-to-markdown](https://github.com/xberg-io/html-to-markdown) — fast, lossless HTML→Markdown engine.
|
|
418
|
+
- [liter-llm](https://github.com/xberg-io/liter-llm) — universal LLM API client with native bindings for 14 languages and 165 providers.
|
|
419
|
+
- [tree-sitter-language-pack](https://github.com/xberg-io/tree-sitter-language-pack) — tree-sitter grammars and code-intelligence primitives.
|
|
420
|
+
- [alef](https://github.com/xberg-io/alef) — the polyglot binding generator that produces every per-language binding across the 5 polyglot repos.
|
|
421
|
+
|
|
422
|
+
## License
|
|
423
|
+
|
|
424
|
+
[MIT License](https://github.com/xberg-io/crawlberg/blob/main/LICENSE)
|
|
425
|
+
|
|
426
|
+
## Links
|
|
427
|
+
|
|
428
|
+
- [Documentation](https://docs.crawlberg.xberg.io)
|
|
429
|
+
- [GitHub Repository](https://github.com/xberg-io/crawlberg)
|
|
430
|
+
- [Issue Tracker](https://github.com/xberg-io/crawlberg/issues)
|
|
431
|
+
- [Changelog](CHANGELOG.md)
|
|
432
|
+
- [Discord](https://discord.gg/xt9WY3GnKR) — community, roadmap, announcements.
|
crawlberg_cli/cli.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""CLI entry point for the crawlberg proxy.
|
|
2
|
+
|
|
3
|
+
A platform-specific wheel bundles the native binary under
|
|
4
|
+
``crawlberg_cli/bin/<target>/``; the sdist (and unknown platforms) ship no binary
|
|
5
|
+
and fall back to the runtime downloader. Each wheel contains exactly one ``bin/<target>``
|
|
6
|
+
directory, so the binary is located by globbing rather than by recomputing the target
|
|
7
|
+
triple (which cannot distinguish glibc from musl at runtime).
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import platform
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
from .downloader import run
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _find_bundled_binary() -> str | None:
|
|
22
|
+
"""Return the path to the bundled native binary if this wheel shipped one."""
|
|
23
|
+
bin_root = Path(__file__).parent / "bin"
|
|
24
|
+
if not bin_root.is_dir():
|
|
25
|
+
return None
|
|
26
|
+
|
|
27
|
+
binary_name = "crawlberg.exe" if platform.system().lower() == "windows" else "crawlberg"
|
|
28
|
+
for candidate in bin_root.glob(f"*/{binary_name}"):
|
|
29
|
+
if candidate.is_file() and os.access(candidate, os.X_OK):
|
|
30
|
+
return str(candidate)
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def main() -> None:
|
|
35
|
+
"""Resolve the native binary (bundled or downloaded) and exec it with forwarded argv."""
|
|
36
|
+
bundled = _find_bundled_binary()
|
|
37
|
+
if bundled:
|
|
38
|
+
completed = subprocess.run([bundled, *sys.argv[1:]], check=False)
|
|
39
|
+
sys.exit(completed.returncode)
|
|
40
|
+
|
|
41
|
+
sys.exit(run(sys.argv[1:]))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if __name__ == "__main__":
|
|
45
|
+
main()
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"""Resolve, download, verify, and run the native crawlberg binary.
|
|
2
|
+
|
|
3
|
+
The package is published in lockstep with the product, so it downloads exactly the
|
|
4
|
+
release whose version it carries (``CRAWLBERG_CLI_VERSION`` overrides that tag
|
|
5
|
+
explicitly; there is no "latest" fallback). Asset discovery queries that release and
|
|
6
|
+
picks the asset whose name contains the platform target triple, instead of hardcoding
|
|
7
|
+
one exact asset name. The archive is checked against the release's SHA256SUMS.
|
|
8
|
+
All diagnostics go to stderr.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import hashlib
|
|
14
|
+
import json
|
|
15
|
+
import os
|
|
16
|
+
import platform
|
|
17
|
+
import re
|
|
18
|
+
import shutil
|
|
19
|
+
import subprocess
|
|
20
|
+
import sys
|
|
21
|
+
import tarfile
|
|
22
|
+
import tempfile
|
|
23
|
+
import zipfile
|
|
24
|
+
from importlib.metadata import PackageNotFoundError
|
|
25
|
+
from importlib.metadata import version as installed_version
|
|
26
|
+
from pathlib import Path, PurePosixPath
|
|
27
|
+
from typing import Any
|
|
28
|
+
from urllib.error import URLError
|
|
29
|
+
from urllib.parse import quote, urlsplit
|
|
30
|
+
from urllib.request import HTTPRedirectHandler, Request, build_opener
|
|
31
|
+
|
|
32
|
+
REPO = "xberg-io/crawlberg"
|
|
33
|
+
BIN_NAME = "crawlberg"
|
|
34
|
+
PKG_NAME = "crawlberg-cli"
|
|
35
|
+
VERSION_ENV = "CRAWLBERG_CLI_VERSION"
|
|
36
|
+
_USER_AGENT = "crawlberg-cli-python-proxy"
|
|
37
|
+
|
|
38
|
+
_PEP440_RE = re.compile(r"^(?P<core>\d+\.\d+\.\d+)(?:(?P<kind>a|b|rc)(?P<number>\d+))?$")
|
|
39
|
+
_TAG_RE = re.compile(r"^v\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$")
|
|
40
|
+
_PRERELEASE_SPELLING = {"a": "alpha", "b": "beta", "rc": "rc"}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _release_tag(package_version: str, override: str | None = None) -> str:
|
|
44
|
+
"""Return the release tag for this package version, or the explicit override.
|
|
45
|
+
|
|
46
|
+
PyPI respells a semver prerelease (``1.14.0-rc.1`` becomes ``1.14.0rc1``); the GitHub
|
|
47
|
+
release tag keeps the semver spelling, so the PEP 440 form is mapped back.
|
|
48
|
+
"""
|
|
49
|
+
if override:
|
|
50
|
+
tag = override
|
|
51
|
+
else:
|
|
52
|
+
match = _PEP440_RE.match(package_version)
|
|
53
|
+
if not match:
|
|
54
|
+
raise RuntimeError(f"cannot derive a release tag from package version '{package_version}'")
|
|
55
|
+
tag = f"v{match['core']}"
|
|
56
|
+
if match["kind"]:
|
|
57
|
+
tag += f"-{_PRERELEASE_SPELLING[match['kind']]}.{match['number']}"
|
|
58
|
+
if not _TAG_RE.match(tag):
|
|
59
|
+
raise RuntimeError(f"refusing to resolve release tag '{tag}'")
|
|
60
|
+
return tag
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _package_version() -> str:
|
|
64
|
+
try:
|
|
65
|
+
return installed_version(PKG_NAME)
|
|
66
|
+
except PackageNotFoundError as exc:
|
|
67
|
+
raise RuntimeError(f"{PKG_NAME} is not installed, so its release version is unknown") from exc
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _target_triple() -> str:
|
|
71
|
+
system = platform.system().lower()
|
|
72
|
+
machine = platform.machine().lower()
|
|
73
|
+
|
|
74
|
+
if system == "windows":
|
|
75
|
+
if machine in {"amd64", "x86_64"}:
|
|
76
|
+
return "x86_64-pc-windows-msvc"
|
|
77
|
+
raise RuntimeError(f"unsupported Windows arch: {machine}")
|
|
78
|
+
if system == "linux":
|
|
79
|
+
if machine in {"amd64", "x86_64"}:
|
|
80
|
+
return "x86_64-unknown-linux-gnu"
|
|
81
|
+
if machine in {"aarch64", "arm64"}:
|
|
82
|
+
return "aarch64-unknown-linux-gnu"
|
|
83
|
+
raise RuntimeError(f"unsupported Linux arch: {machine}")
|
|
84
|
+
if system == "darwin":
|
|
85
|
+
if machine in {"aarch64", "arm64"}:
|
|
86
|
+
return "aarch64-apple-darwin"
|
|
87
|
+
if machine in {"amd64", "x86_64"}:
|
|
88
|
+
return "x86_64-apple-darwin"
|
|
89
|
+
raise RuntimeError(f"unsupported macOS arch: {machine}")
|
|
90
|
+
raise RuntimeError(f"unsupported platform: {system} {machine}")
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _binary_name() -> str:
|
|
94
|
+
return f"{BIN_NAME}.exe" if platform.system().lower() == "windows" else BIN_NAME
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class _HttpsOnlyRedirectHandler(HTTPRedirectHandler):
|
|
98
|
+
"""Reject any redirect whose target is not https (downgrade/SSRF guard)."""
|
|
99
|
+
|
|
100
|
+
def redirect_request(self, req, fp, code, msg, headers, newurl): # type: ignore[no-untyped-def]
|
|
101
|
+
if urlsplit(newurl).scheme.lower() != "https":
|
|
102
|
+
raise URLError(f"refusing non-https redirect to: {newurl}")
|
|
103
|
+
return super().redirect_request(req, fp, code, msg, headers, newurl)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
_opener = build_opener(_HttpsOnlyRedirectHandler())
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _http_get(url: str, accept: str | None = None) -> bytes:
|
|
110
|
+
if urlsplit(url).scheme.lower() != "https":
|
|
111
|
+
raise RuntimeError(f"refusing non-https URL: {url}")
|
|
112
|
+
headers = {"User-Agent": _USER_AGENT}
|
|
113
|
+
if accept:
|
|
114
|
+
headers["Accept"] = accept
|
|
115
|
+
request = Request(url, headers=headers)
|
|
116
|
+
try:
|
|
117
|
+
with _opener.open(request, timeout=60) as response:
|
|
118
|
+
if response.status != 200:
|
|
119
|
+
raise RuntimeError(f"HTTP {response.status} for {url}")
|
|
120
|
+
body: bytes = response.read()
|
|
121
|
+
return body
|
|
122
|
+
except URLError as exc:
|
|
123
|
+
raise RuntimeError(f"failed to fetch {url}: {exc}") from exc
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _asset_score(name: str) -> int:
|
|
127
|
+
lowered = name.lower()
|
|
128
|
+
score = 0
|
|
129
|
+
if BIN_NAME.lower() in lowered:
|
|
130
|
+
score += 2
|
|
131
|
+
if "cli" in lowered:
|
|
132
|
+
score += 1
|
|
133
|
+
return score
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _resolve_release() -> tuple[str, dict[str, Any], dict[str, Any] | None]:
|
|
137
|
+
"""Return (tag, archive_asset, checksums_asset_or_none) for this platform."""
|
|
138
|
+
triple = _target_triple()
|
|
139
|
+
pinned = _release_tag(_package_version(), os.getenv(VERSION_ENV))
|
|
140
|
+
api_url = f"https://api.github.com/repos/{REPO}/releases/tags/{quote(pinned, safe='')}"
|
|
141
|
+
|
|
142
|
+
release = json.loads(_http_get(api_url, accept="application/vnd.github+json"))
|
|
143
|
+
assets = release.get("assets") or []
|
|
144
|
+
tag = release.get("tag_name") or pinned
|
|
145
|
+
|
|
146
|
+
archives = [
|
|
147
|
+
a
|
|
148
|
+
for a in assets
|
|
149
|
+
if triple in (a.get("name") or "").lower()
|
|
150
|
+
and ((a.get("name") or "").lower().endswith(".tar.gz") or (a.get("name") or "").lower().endswith(".zip"))
|
|
151
|
+
]
|
|
152
|
+
if not archives:
|
|
153
|
+
raise RuntimeError(f'no release asset matching target triple "{triple}" in {REPO} release {tag}')
|
|
154
|
+
archives.sort(key=lambda a: _asset_score(a.get("name") or ""), reverse=True)
|
|
155
|
+
archive = archives[0]
|
|
156
|
+
|
|
157
|
+
checksums = next((a for a in assets if "SHA256SUMS" in (a.get("name") or "").upper()), None)
|
|
158
|
+
return tag, archive, checksums
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _expected_digest(text: str, asset_name: str) -> str | None:
|
|
162
|
+
for line in text.splitlines():
|
|
163
|
+
stripped = line.strip()
|
|
164
|
+
if not stripped:
|
|
165
|
+
continue
|
|
166
|
+
parts = stripped.split()
|
|
167
|
+
if len(parts) < 2:
|
|
168
|
+
continue
|
|
169
|
+
name = parts[-1].lstrip("*")
|
|
170
|
+
if name == asset_name:
|
|
171
|
+
return parts[0].lower()
|
|
172
|
+
return None
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def _verify_checksum(archive_path: Path, asset_name: str, sums_text: str, sums_name: str = "SHA256SUMS") -> None:
|
|
176
|
+
expected = _expected_digest(sums_text, asset_name)
|
|
177
|
+
if not expected:
|
|
178
|
+
raise RuntimeError(f"no checksum entry for {asset_name} in {sums_name} — refusing to install unverified binary")
|
|
179
|
+
digest = hashlib.sha256(archive_path.read_bytes()).hexdigest().lower()
|
|
180
|
+
if digest != expected:
|
|
181
|
+
raise RuntimeError(f"checksum mismatch for {asset_name} (expected {expected}, got {digest})")
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def _verify_or_warn(archive_path: Path, asset_name: str, checksums: dict[str, Any] | None) -> None:
|
|
185
|
+
if not checksums:
|
|
186
|
+
print(
|
|
187
|
+
f"WARNING: no SHA256SUMS asset found for {asset_name}; "
|
|
188
|
+
"installing over HTTPS without checksum verification.",
|
|
189
|
+
file=sys.stderr,
|
|
190
|
+
)
|
|
191
|
+
return
|
|
192
|
+
sums_text = _http_get(checksums["browser_download_url"]).decode("utf-8")
|
|
193
|
+
_verify_checksum(archive_path, asset_name, sums_text, checksums["name"])
|
|
194
|
+
print(f"Checksum verified for {asset_name}.", file=sys.stderr)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def _is_within(base: Path, target: Path) -> bool:
|
|
198
|
+
"""True if `target`'s resolved path stays inside `base`."""
|
|
199
|
+
base_resolved = base.resolve()
|
|
200
|
+
try:
|
|
201
|
+
target.resolve().relative_to(base_resolved)
|
|
202
|
+
except ValueError:
|
|
203
|
+
return False
|
|
204
|
+
return True
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def _reject_unsafe_member(name: str) -> None:
|
|
208
|
+
"""Reject absolute paths and any `..` component (zip-slip / tar-slip)."""
|
|
209
|
+
normalized = name.replace("\\", "/")
|
|
210
|
+
pure = PurePosixPath(normalized)
|
|
211
|
+
if pure.is_absolute() or normalized.startswith("/"):
|
|
212
|
+
raise RuntimeError(f"refusing absolute path in archive: {name}")
|
|
213
|
+
if len(normalized) >= 2 and normalized[1] == ":":
|
|
214
|
+
raise RuntimeError(f"refusing absolute path in archive: {name}")
|
|
215
|
+
if any(part == ".." for part in pure.parts):
|
|
216
|
+
raise RuntimeError(f"refusing parent-directory escape in archive: {name}")
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def _safe_extract(archive_path: Path, asset_name: str, dest: Path) -> None:
|
|
220
|
+
"""Extract a tar/zip, validating every member stays within `dest`.
|
|
221
|
+
|
|
222
|
+
Does not rely on extractall() defaults or the 3.12-only ``filter='data'``:
|
|
223
|
+
each member name is rejected up front if it is absolute or contains ``..``,
|
|
224
|
+
and the resolved destination path is re-checked against ``dest``.
|
|
225
|
+
"""
|
|
226
|
+
dest = dest.resolve()
|
|
227
|
+
dest.mkdir(parents=True, exist_ok=True)
|
|
228
|
+
|
|
229
|
+
if asset_name.lower().endswith(".zip"):
|
|
230
|
+
with zipfile.ZipFile(archive_path) as zf:
|
|
231
|
+
for entry in zf.namelist():
|
|
232
|
+
_reject_unsafe_member(entry)
|
|
233
|
+
if not _is_within(dest, dest / entry):
|
|
234
|
+
raise RuntimeError(f"refusing archive entry escaping dest: {entry}")
|
|
235
|
+
for entry in zf.namelist():
|
|
236
|
+
zf.extract(entry, dest)
|
|
237
|
+
else:
|
|
238
|
+
with tarfile.open(archive_path, "r:gz") as tf:
|
|
239
|
+
for member in tf.getmembers():
|
|
240
|
+
_reject_unsafe_member(member.name)
|
|
241
|
+
if not _is_within(dest, dest / member.name):
|
|
242
|
+
raise RuntimeError(f"refusing archive entry escaping dest: {member.name}")
|
|
243
|
+
if member.islnk() or member.issym():
|
|
244
|
+
link_target = dest / member.name
|
|
245
|
+
if not _is_within(dest, link_target.parent / member.linkname):
|
|
246
|
+
raise RuntimeError(f"refusing link escaping dest: {member.name}")
|
|
247
|
+
tf.extractall(dest) # noqa: S202 (members validated above)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def _find_binary(root: Path, name: str) -> Path | None:
|
|
251
|
+
for candidate in root.rglob(name):
|
|
252
|
+
if candidate.is_file():
|
|
253
|
+
return candidate
|
|
254
|
+
return None
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def _cache_dir(tag: str) -> Path:
|
|
258
|
+
cache = Path.home() / ".cache" / PKG_NAME / tag
|
|
259
|
+
cache.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
260
|
+
return cache
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def ensure_binary() -> str:
|
|
264
|
+
"""Ensure the native binary exists locally, downloading if necessary."""
|
|
265
|
+
override = os.getenv("CRAWLBERG_BINARY")
|
|
266
|
+
if override:
|
|
267
|
+
return override
|
|
268
|
+
|
|
269
|
+
tag, archive, checksums = _resolve_release()
|
|
270
|
+
cache = _cache_dir(tag)
|
|
271
|
+
binary_path = cache / _binary_name()
|
|
272
|
+
if binary_path.exists() and os.access(binary_path, os.X_OK):
|
|
273
|
+
return str(binary_path)
|
|
274
|
+
|
|
275
|
+
print(f"Downloading {BIN_NAME} {tag} asset {archive['name']}...", file=sys.stderr)
|
|
276
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
277
|
+
tmp = Path(tmpdir)
|
|
278
|
+
archive_path = tmp / Path(archive["name"]).name
|
|
279
|
+
archive_path.write_bytes(_http_get(archive["browser_download_url"]))
|
|
280
|
+
_verify_or_warn(archive_path, archive["name"], checksums)
|
|
281
|
+
extract_dir = tmp / "extract"
|
|
282
|
+
extract_dir.mkdir()
|
|
283
|
+
_safe_extract(archive_path, archive["name"], extract_dir)
|
|
284
|
+
found = _find_binary(extract_dir, _binary_name())
|
|
285
|
+
if not found:
|
|
286
|
+
raise RuntimeError(f"binary {_binary_name()} not found after extracting {archive['name']}")
|
|
287
|
+
shutil.move(str(found), str(binary_path))
|
|
288
|
+
|
|
289
|
+
if platform.system().lower() != "windows":
|
|
290
|
+
binary_path.chmod(0o755)
|
|
291
|
+
print(f"{BIN_NAME} installed.", file=sys.stderr)
|
|
292
|
+
return str(binary_path)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def run(args: list[str]) -> int:
|
|
296
|
+
"""Run the native binary with the given args, returning its exit code."""
|
|
297
|
+
binary_path = ensure_binary()
|
|
298
|
+
completed = subprocess.run([binary_path, *args], check=False)
|
|
299
|
+
return completed.returncode
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: crawlberg-cli
|
|
3
|
+
Version: 1.13.3
|
|
4
|
+
Summary: CLI proxy for crawlberg — downloads and runs the native crawlberg binary from GitHub releases.
|
|
5
|
+
Project-URL: Homepage, https://github.com/xberg-io/crawlberg
|
|
6
|
+
Project-URL: Issues, https://github.com/xberg-io/crawlberg/issues
|
|
7
|
+
Project-URL: Repository, https://github.com/xberg-io/crawlberg.git
|
|
8
|
+
Author-email: Na'aman Hirschfeld <naaman@xberg.io>, Tobias Perlstein <tobias@xberg.io>
|
|
9
|
+
Maintainer-email: Na'aman Hirschfeld <naaman@xberg.io>, Tobias Perlstein <tobias@xberg.io>
|
|
10
|
+
License: MIT
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# crawlberg-cli
|
|
24
|
+
|
|
25
|
+
CLI proxy for [`crawlberg`](https://github.com/xberg-io/crawlberg). Installing
|
|
26
|
+
this package provides a `crawlberg` command. Platform wheels bundle the native
|
|
27
|
+
binary; the source distribution downloads the binary of the matching release
|
|
28
|
+
from GitHub and verifies it against that release's SHA256SUMS.
|
|
29
|
+
|
|
30
|
+
The package version is the crawlberg release version, so a given version of this
|
|
31
|
+
package only ever runs (or downloads) that release. Override the release tag
|
|
32
|
+
explicitly with the `CRAWLBERG_CLI_VERSION` environment variable.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
crawlberg_cli/__init__.py,sha256=QTth4T_5BAoxSDVqBcQCbGtXdLNtAtkH5QGTFUORY4c,195
|
|
2
|
+
crawlberg_cli/cli.py,sha256=L_FVpJg93t1906hqJs_7_zSP5vGCSfgOV2NxSh7I_l8,1414
|
|
3
|
+
crawlberg_cli/downloader.py,sha256=B1vn1gjiGb5_oV6IRPUk_EV6sCPYjnwGraEO4WJxM8A,11637
|
|
4
|
+
crawlberg_cli/bin/x86_64-pc-windows-msvc/LICENSE,sha256=LfDLrEYGJ0j6D1gsVxffMtZmB95NN68Uc854XDG2C1Q,1098
|
|
5
|
+
crawlberg_cli/bin/x86_64-pc-windows-msvc/README.md,sha256=lU2gjD4FNhg13Pgli7S2nehICJDl-H2c3Szp8YAXpxI,16924
|
|
6
|
+
crawlberg_cli/bin/x86_64-pc-windows-msvc/crawlberg.exe,sha256=Tjz-4hi6W8FMKvbeokJIVnOXH1B1QUxJWe3rq0q6p0M,54378496
|
|
7
|
+
crawlberg_cli-1.13.3.dist-info/METADATA,sha256=HKmQ6aE5g28jV4td8nA8kz9mBw7WkRgc08oG3716g98,1587
|
|
8
|
+
crawlberg_cli-1.13.3.dist-info/WHEEL,sha256=lpoBGaIUIidvvdZ4qRAP61bBKYJdt4FI3WXFL50Gzyo,94
|
|
9
|
+
crawlberg_cli-1.13.3.dist-info/entry_points.txt,sha256=-R45XpFMu82UAYt8QpTTzv5cIwd6nIdLnNBd233MN4M,53
|
|
10
|
+
crawlberg_cli-1.13.3.dist-info/RECORD,,
|