@zenrows/cli 1.4.2 → 1.5.0
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/README.md +84 -11
- package/dist/src/cli/commands/crawl.js +535 -0
- package/dist/src/cli/index.js +2 -1
- package/dist/src/cli/output.js +38 -15
- package/dist/src/core/config.js +1 -1
- package/dist/src/core/crawl-api.js +418 -0
- package/dist/src/core/errors.js +9 -0
- package/package.json +2 -1
- package/registry/capabilities.json +9 -0
- package/registry/skills.json +11 -0
- package/skills/crawl/SKILL.md +126 -0
- package/skills/trace-debug/SKILL.md +12 -0
- package/skills/zenrows/SKILL.md +5 -0
package/README.md
CHANGED
|
@@ -39,6 +39,7 @@ that endpoint with extraction parameters, not a separate product.
|
|
|
39
39
|
| `zenrows fetch` | Fetch — retrieve a protected page | **available** — `GET https://api.zenrows.com/v1/` |
|
|
40
40
|
| `zenrows extract` | Extract — `extract=auto` (domain-gated open beta; falls back to Autoparse) / CSS / Markdown | **beta** — same `/v1/` |
|
|
41
41
|
| `zenrows batch` | Batch — fan out over many URLs | beta — cloud works with beta access; local validate/estimate always |
|
|
42
|
+
| `zenrows crawl` | Crawl (new) — collect the URLs behind one start page, optionally with each page's HTML | **available** — `https://api.zenrows.com/v1/crawls` |
|
|
42
43
|
| `zenrows browser` | Browser Sessions REST API (same backend as MCP `browser_*`) | **available** — escalation-only; bills by bandwidth + time |
|
|
43
44
|
| `zenrows mcp` | MCP server config (remote + local) | **available** |
|
|
44
45
|
| Zenrows CLI | this repo | available |
|
|
@@ -156,7 +157,79 @@ An Extract task costs the same as a regular one (1 credit at base tier), so
|
|
|
156
157
|
keys: `html` (the raw page) and `parsed` (the structured data) — validate a
|
|
157
158
|
sample with `zenrows extract <url>` before running the full batch.
|
|
158
159
|
|
|
159
|
-
## 10.
|
|
160
|
+
## 10. Crawl (new)
|
|
161
|
+
|
|
162
|
+
Crawl is still evolving: new features are coming, limits may be tuned, and the changelog announces each change.
|
|
163
|
+
|
|
164
|
+
Crawl (`https://api.zenrows.com/v1/crawls`)
|
|
165
|
+
takes one start URL and returns the URLs it finds behind it, optionally with
|
|
166
|
+
each page's HTML. Use it when you know the listing or section but not the item
|
|
167
|
+
URLs. Crawl follows the links on each page, up to `--depth` hops when you set
|
|
168
|
+
it, and stays on the start URL's registrable domain (subdomains count). Without
|
|
169
|
+
`--output-format html` it returns URLs only. An account without Crawl access gets
|
|
170
|
+
`CRAWL_NOT_ENABLED` ("Crawl is not enabled for this account", HTTP 403
|
|
171
|
+
`REQS008`).
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
zenrows crawl create https://example.com/products/ --depth 1 \
|
|
175
|
+
--max-items 20 --include-patterns /product/ --follow # create and wait for the end
|
|
176
|
+
zenrows crawl results <crawl-id> --out urls.jsonl # every kept URL (paginated)
|
|
177
|
+
zenrows crawl create <url> --depth 2 --output-format html # also fetch each kept page's HTML
|
|
178
|
+
zenrows crawl content <crawl-id> <content-id> # one page's HTML
|
|
179
|
+
zenrows crawl download <crawl-id> # NDJSON export (URLs + HTML) → <crawl-id>.jsonl
|
|
180
|
+
zenrows crawl get <crawl-id> # status, coverage, stop reason, one page of results
|
|
181
|
+
zenrows crawl wait <crawl-id> # wait for the end
|
|
182
|
+
zenrows crawl list # your crawls, newest first
|
|
183
|
+
zenrows crawl stop <crawl-id> # stop a running crawl
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
`--depth` (link hops, 1 to 100000) is optional: leave it out and the crawl
|
|
187
|
+
follows links until `--max-items` or `--max-pages` stops it, or nothing is left
|
|
188
|
+
to open. `--max-items` and `--max-pages` cap the crawl (API default 100 each),
|
|
189
|
+
and `--max-pages` bounds the cost, since each page is one fetch. The local policy `max_pages_per_run` caps `--max-pages` (default
|
|
190
|
+
1000). `--output-format html` uses up the page budget: each kept page is one
|
|
191
|
+
more fetch, and `--max-pages` counts it. `--include-patterns` /
|
|
192
|
+
`--exclude-patterns` are repeatable substring filters on the URL. `get` and
|
|
193
|
+
`list` read one page and take `--cursor` and `--limit`. `results` follows every
|
|
194
|
+
page (`--limit` is the page size); on a running crawl it returns the URLs kept
|
|
195
|
+
so far, with `partial: true`. `download` reports the crawl's `status` (`null`
|
|
196
|
+
when the API sends none), and `partial: true` while it runs.
|
|
197
|
+
|
|
198
|
+
With `--json`, `create`, `get`, `wait` and `stop` print
|
|
199
|
+
`{ok, crawl_id, status, crawl}`. The crawl object (with `coverage`,
|
|
200
|
+
`stop_reason` and `error`) is under `crawl`. `get` adds `results` and
|
|
201
|
+
`next_cursor`. All keys are snake_case.
|
|
202
|
+
|
|
203
|
+
`wait`, and `create --follow`, poll until the crawl ends or `--timeout` seconds
|
|
204
|
+
run out (default 600). When the time runs out, the command exits 0 and prints
|
|
205
|
+
the crawl with status `running` and the hint `zenrows crawl wait <crawl-id>`
|
|
206
|
+
(under `--json`, in `note`); the crawl keeps running. Ctrl-C stops the wait, not the crawl, and exits 130;
|
|
207
|
+
resume with `zenrows crawl wait <crawl-id>`. A crawl that ends `failed` exits 1
|
|
208
|
+
with `CRAWL_FAILED`.
|
|
209
|
+
|
|
210
|
+
Errors carry the API's code as `server_code`, `crawl_id` on any call about one
|
|
211
|
+
crawl, and `retry_after` on a 429. When the account has reached its limit of
|
|
212
|
+
active jobs (3 by default), shared with its Batch jobs, a create gets 429
|
|
213
|
+
`too_many_crawls`, mapped to `CRAWL_TOO_MANY_CRAWLS`, and creates nothing; retry
|
|
214
|
+
after `retry_after` seconds. Any other 429 is `CRAWL_RATE_LIMITED`: requests
|
|
215
|
+
are being throttled; retry after `retry_after` seconds. Other codes: `CRAWL_INSUFFICIENT_CREDITS` and `CRAWL_KEY_CAP_REACHED` (402, with the
|
|
216
|
+
same claim, top-up and key-cap advice as other commands),
|
|
217
|
+
`CRAWL_INVALID_REQUEST` (400/422, do not retry as is), `CRAWL_REQUEST_IN_FLIGHT`
|
|
218
|
+
(409, retry once the first request ends), `CRAWL_NOT_FOUND`,
|
|
219
|
+
`CRAWL_CONTENT_NOT_FOUND`, `CRAWL_BUSY` (503 on a stop that was not saved yet;
|
|
220
|
+
run it again, it is safe) and `CRAWL_FAILED`. Set `ZENROWS_CRAWL_API_BASE` to
|
|
221
|
+
point the CLI at another deployment.
|
|
222
|
+
|
|
223
|
+
The CLI retries transient failures, as the Crawl SDKs do: up to 3 retries,
|
|
224
|
+
waiting the `Retry-After` seconds (at most 30) or 250 ms x 2^n (+/-20% jitter,
|
|
225
|
+
at most 10 s).
|
|
226
|
+
Reads retry on 429, 502, 503, 504 and network errors (a timeout counts).
|
|
227
|
+
`create` retries only with `--idempotency-key`, and only on 502, 503, 504 and
|
|
228
|
+
network errors, never on 429. `stop` retries on 429, 502, 503 (a `crawl_busy`
|
|
229
|
+
means the stop was not saved and the crawl still runs) and 504, waiting the
|
|
230
|
+
`Retry-After` seconds (at most 30) or 1 s; repeating a stop is safe.
|
|
231
|
+
|
|
232
|
+
## 11. Browser Sessions
|
|
160
233
|
|
|
161
234
|
Escalation only — **prefer `fetch`/`extract` for the vast majority of cases**;
|
|
162
235
|
they cost less. Use the browser for logins, forms, and multi-step JS flows that
|
|
@@ -170,7 +243,7 @@ bring-your-own Playwright/Puppeteer.
|
|
|
170
243
|
close interactive sessions with `zenrows browser close`. On by default; opt out
|
|
171
244
|
with `zenrows policy set allow_browser false`.
|
|
172
245
|
|
|
173
|
-
##
|
|
246
|
+
## 12. MCP
|
|
174
247
|
|
|
175
248
|
```bash
|
|
176
249
|
zenrows mcp status
|
|
@@ -188,7 +261,7 @@ both servers in `mcp.json` (no secrets) and ships MCP-native skills under
|
|
|
188
261
|
`agent-plugin/skills/`. It is included in the published `@zenrows/cli` npm
|
|
189
262
|
tarball (`node_modules/@zenrows/cli/agent-plugin`).
|
|
190
263
|
|
|
191
|
-
##
|
|
264
|
+
## 13. Plugins
|
|
192
265
|
|
|
193
266
|
```bash
|
|
194
267
|
zenrows plugin list
|
|
@@ -201,7 +274,7 @@ MCP-native skills). See [`agent-plugin/README.md`](agent-plugin/README.md).
|
|
|
201
274
|
Legacy per-client snippets from `zenrows plugin install` remain available.
|
|
202
275
|
CLI-oriented skills stay under repo-root `skills/`.
|
|
203
276
|
|
|
204
|
-
##
|
|
277
|
+
## 14. Skills
|
|
205
278
|
|
|
206
279
|
Agent-readable playbooks that teach agents how to choose primitives.
|
|
207
280
|
|
|
@@ -213,28 +286,28 @@ zenrows skill validate zenrows
|
|
|
213
286
|
|
|
214
287
|
The master skill `skills/zenrows/SKILL.md` teaches the full decision tree.
|
|
215
288
|
|
|
216
|
-
##
|
|
289
|
+
## 15. Templates
|
|
217
290
|
|
|
218
291
|
```bash
|
|
219
292
|
zenrows template list
|
|
220
293
|
zenrows template create protected-fetch-node --output ./my-project
|
|
221
294
|
```
|
|
222
295
|
|
|
223
|
-
##
|
|
296
|
+
## 16. Workflows
|
|
224
297
|
|
|
225
298
|
```bash
|
|
226
299
|
zenrows workflow list
|
|
227
300
|
zenrows workflow explain competitor-intelligence
|
|
228
301
|
```
|
|
229
302
|
|
|
230
|
-
##
|
|
303
|
+
## 17. Recipes
|
|
231
304
|
|
|
232
305
|
```bash
|
|
233
306
|
zenrows recipe list
|
|
234
307
|
zenrows recipe run fetch-protected-page
|
|
235
308
|
```
|
|
236
309
|
|
|
237
|
-
##
|
|
310
|
+
## 18. Evals
|
|
238
311
|
|
|
239
312
|
Reproducible, transparent benchmarks. **No competitor keys are bundled** and
|
|
240
313
|
nothing is hardcoded to make Zenrows win — comparison evals require you to supply
|
|
@@ -249,7 +322,7 @@ zenrows eval report protected-fetch-smoke
|
|
|
249
322
|
Reports write `input.json`, `results.json`, `report.md`, `failures.jsonl`,
|
|
250
323
|
`cost.json`, and `traces/` under `.zenrows/evals/<run-id>/`.
|
|
251
324
|
|
|
252
|
-
##
|
|
325
|
+
## 19. Security
|
|
253
326
|
|
|
254
327
|
- API keys are never printed or written into run artifacts/assets.
|
|
255
328
|
- Secrets live in `.zenrows/secrets.json` (0600, gitignored); logs are redacted.
|
|
@@ -259,12 +332,12 @@ Reports write `input.json`, `results.json`, `report.md`, `failures.jsonl`,
|
|
|
259
332
|
- Destructive `uninstall` requires `--yes`. Browser is on by default; opt out with
|
|
260
333
|
`zenrows policy set allow_browser false`. Experimental features are off by default.
|
|
261
334
|
|
|
262
|
-
##
|
|
335
|
+
## 20. Capability matrix
|
|
263
336
|
|
|
264
337
|
See [`registry/capabilities.json`](registry/capabilities.json). `zenrows status
|
|
265
338
|
--json` emits it.
|
|
266
339
|
|
|
267
|
-
##
|
|
340
|
+
## 21. Contributing
|
|
268
341
|
|
|
269
342
|
The CLI is TypeScript with **zero runtime dependencies** (native `fetch`,
|
|
270
343
|
`node:util` `parseArgs`, `node:test`). Node 20+ runs the published build;
|