crw-sdk 0.43.2 → 0.44.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/dist/cjs/client.js +4 -0
- package/dist/esm/client.js +4 -0
- package/dist/esm/types.d.ts +7 -0
- package/package.json +1 -1
package/dist/cjs/client.js
CHANGED
|
@@ -114,6 +114,10 @@ class CrwClient {
|
|
|
114
114
|
Object.assign(args, rest);
|
|
115
115
|
if (this.apiUrl)
|
|
116
116
|
return this.httpPost("/v1/scrape", args);
|
|
117
|
+
if (args.mode === "auto" || args.mode === "max") {
|
|
118
|
+
throw new errors_js_1.CrwError(`mode "${args.mode}" is a fastCRW cloud feature (it is billed per page). ` +
|
|
119
|
+
"Set CRW_API_KEY to use the cloud; a self-hosted engine ignores mode.");
|
|
120
|
+
}
|
|
117
121
|
return this.localTransport().toolCall("crw_scrape", args);
|
|
118
122
|
}
|
|
119
123
|
async crawl(url, opts = {}) {
|
package/dist/esm/client.js
CHANGED
|
@@ -111,6 +111,10 @@ export class CrwClient {
|
|
|
111
111
|
Object.assign(args, rest);
|
|
112
112
|
if (this.apiUrl)
|
|
113
113
|
return this.httpPost("/v1/scrape", args);
|
|
114
|
+
if (args.mode === "auto" || args.mode === "max") {
|
|
115
|
+
throw new CrwError(`mode "${args.mode}" is a fastCRW cloud feature (it is billed per page). ` +
|
|
116
|
+
"Set CRW_API_KEY to use the cloud; a self-hosted engine ignores mode.");
|
|
117
|
+
}
|
|
114
118
|
return this.localTransport().toolCall("crw_scrape", args);
|
|
115
119
|
}
|
|
116
120
|
async crawl(url, opts = {}) {
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -30,6 +30,13 @@ export interface ScrapeOptions {
|
|
|
30
30
|
* of `jsonSchema` comes back as a {@link Basis}. Requires `jsonSchema`.
|
|
31
31
|
*/
|
|
32
32
|
basis?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Cloud only. `"standard"` (default), `"auto"` or `"max"`. Auto and max get
|
|
35
|
+
* through anti-bot walls and are billed by the traffic the page used.
|
|
36
|
+
*/
|
|
37
|
+
mode?: "standard" | "auto" | "max";
|
|
38
|
+
/** Cloud only, with `mode` auto or max: the most this page may cost. */
|
|
39
|
+
maxCredits?: number;
|
|
33
40
|
/** Any other engine scrape option, passed through verbatim. */
|
|
34
41
|
[key: string]: unknown;
|
|
35
42
|
}
|
package/package.json
CHANGED