scrapfly-sdk 0.11.1 → 0.12.1
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 +72 -5
- package/esm/browserconfig.d.ts +57 -9
- package/esm/browserconfig.d.ts.map +1 -1
- package/esm/browserconfig.js +63 -5
- package/esm/browserdownloads.d.ts +70 -0
- package/esm/browserdownloads.d.ts.map +1 -0
- package/esm/browserdownloads.js +215 -0
- package/esm/client.d.ts +224 -8
- package/esm/client.d.ts.map +1 -1
- package/esm/client.js +646 -62
- package/esm/crawl.d.ts +83 -1
- package/esm/crawl.d.ts.map +1 -1
- package/esm/crawl.js +73 -0
- package/esm/crawlerconfig.d.ts +54 -3
- package/esm/crawlerconfig.d.ts.map +1 -1
- package/esm/crawlerconfig.js +96 -2
- package/esm/crawlerresult.d.ts +374 -2
- package/esm/crawlerresult.d.ts.map +1 -1
- package/esm/crawlerresult.js +367 -1
- package/esm/errors.d.ts +12 -0
- package/esm/errors.d.ts.map +1 -1
- package/esm/errors.js +11 -0
- package/esm/main.d.ts +12 -7
- package/esm/main.d.ts.map +1 -1
- package/esm/main.js +10 -5
- package/esm/monitoringconfig.d.ts +2 -2
- package/esm/result.d.ts +11 -1
- package/esm/result.d.ts.map +1 -1
- package/esm/result.js +14 -5
- package/esm/scrapeconfig.d.ts +65 -1
- package/esm/scrapeconfig.d.ts.map +1 -1
- package/esm/scrapeconfig.js +88 -4
- package/esm/screenshotconfig.d.ts +9 -1
- package/esm/screenshotconfig.d.ts.map +1 -1
- package/esm/screenshotconfig.js +12 -1
- package/esm/types.d.ts +128 -0
- package/esm/types.d.ts.map +1 -1
- package/esm/types.js +22 -1
- package/esm/utils.d.ts.map +1 -1
- package/esm/utils.js +16 -2
- package/esm/webhookserver.d.ts +33 -15
- package/esm/webhookserver.d.ts.map +1 -1
- package/esm/webhookserver.js +197 -38
- package/package.json +1 -1
- package/script/browserconfig.d.ts +57 -9
- package/script/browserconfig.d.ts.map +1 -1
- package/script/browserconfig.js +63 -5
- package/script/browserdownloads.d.ts +70 -0
- package/script/browserdownloads.d.ts.map +1 -0
- package/script/browserdownloads.js +221 -0
- package/script/client.d.ts +224 -8
- package/script/client.d.ts.map +1 -1
- package/script/client.js +645 -61
- package/script/crawl.d.ts +83 -1
- package/script/crawl.d.ts.map +1 -1
- package/script/crawl.js +73 -0
- package/script/crawlerconfig.d.ts +54 -3
- package/script/crawlerconfig.d.ts.map +1 -1
- package/script/crawlerconfig.js +97 -3
- package/script/crawlerresult.d.ts +374 -2
- package/script/crawlerresult.d.ts.map +1 -1
- package/script/crawlerresult.js +374 -2
- package/script/errors.d.ts +12 -0
- package/script/errors.d.ts.map +1 -1
- package/script/errors.js +12 -1
- package/script/main.d.ts +12 -7
- package/script/main.d.ts.map +1 -1
- package/script/main.js +20 -4
- package/script/monitoringconfig.d.ts +2 -2
- package/script/result.d.ts +11 -1
- package/script/result.d.ts.map +1 -1
- package/script/result.js +14 -5
- package/script/scrapeconfig.d.ts +65 -1
- package/script/scrapeconfig.d.ts.map +1 -1
- package/script/scrapeconfig.js +88 -4
- package/script/screenshotconfig.d.ts +9 -1
- package/script/screenshotconfig.d.ts.map +1 -1
- package/script/screenshotconfig.js +12 -1
- package/script/types.d.ts +128 -0
- package/script/types.d.ts.map +1 -1
- package/script/types.js +23 -0
- package/script/utils.d.ts.map +1 -1
- package/script/utils.js +16 -2
- package/script/webhookserver.d.ts +33 -15
- package/script/webhookserver.d.ts.map +1 -1
- package/script/webhookserver.js +197 -38
- package/src/browserconfig.ts +74 -8
- package/src/browserdownloads.ts +266 -0
- package/src/client.ts +796 -65
- package/src/crawl.ts +106 -0
- package/src/crawlerconfig.ts +128 -5
- package/src/crawlerresult.ts +607 -3
- package/src/errors.ts +12 -0
- package/src/main.ts +55 -5
- package/src/monitoringconfig.ts +2 -2
- package/src/result.ts +17 -5
- package/src/scrapeconfig.ts +92 -3
- package/src/screenshotconfig.ts +14 -1
- package/src/types.ts +159 -1
- package/src/utils.ts +16 -2
- package/src/webhookserver.ts +235 -39
package/script/crawl.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScrapflyClient } from './client.js';
|
|
2
2
|
import type { CrawlerConfig, CrawlerContentFormat } from './crawlerconfig.js';
|
|
3
|
-
import type { CrawlerArtifact, CrawlerStatus, CrawlerUrls } from './crawlerresult.js';
|
|
3
|
+
import type { CrawlerArtifact, CrawlerExtractResponse, CrawlerPromptAnswer, CrawlerPromptEvent, CrawlerRefreshEntry, CrawlerRefreshState, CrawlerSearchMode, CrawlerSearchResponse, CrawlerStatus, CrawlerUrls } from './crawlerresult.js';
|
|
4
4
|
/**
|
|
5
5
|
* High-level fluent wrapper around a single crawler job lifecycle.
|
|
6
6
|
*
|
|
@@ -96,6 +96,88 @@ export declare class Crawl {
|
|
|
96
96
|
page?: number;
|
|
97
97
|
per_page?: number;
|
|
98
98
|
}): Promise<CrawlerUrls>;
|
|
99
|
+
/**
|
|
100
|
+
* Search this crawl's index.
|
|
101
|
+
*
|
|
102
|
+
* Sugar over `client.crawlSearch([uuid], ...)`. The cross-crawl call is the
|
|
103
|
+
* real endpoint; both share its implementation so single and multi-crawl
|
|
104
|
+
* search cannot drift.
|
|
105
|
+
*
|
|
106
|
+
* Requires the crawl to have been started with `search: true` and its index
|
|
107
|
+
* to have reached `READY`/`PARTIAL`; poll `CrawlerStatus.search` or
|
|
108
|
+
* subscribe to the `crawler_search_ready` webhook. An index that is not
|
|
109
|
+
* ready yet is reported in the response's `skipped` list, not as an error.
|
|
110
|
+
*/
|
|
111
|
+
search(query: string, opts?: {
|
|
112
|
+
limit?: number;
|
|
113
|
+
mode?: CrawlerSearchMode;
|
|
114
|
+
filters?: Record<string, any>;
|
|
115
|
+
cursor?: string;
|
|
116
|
+
}): Promise<CrawlerSearchResponse>;
|
|
117
|
+
/**
|
|
118
|
+
* Ask a question answered from this crawl's content.
|
|
119
|
+
*
|
|
120
|
+
* Sugar over `client.crawlPrompt([uuid], ...)`; yields the same frames.
|
|
121
|
+
*/
|
|
122
|
+
prompt(prompt: string, opts?: {
|
|
123
|
+
search?: {
|
|
124
|
+
limit?: number;
|
|
125
|
+
mode?: CrawlerSearchMode;
|
|
126
|
+
filters?: Record<string, any>;
|
|
127
|
+
};
|
|
128
|
+
model?: string;
|
|
129
|
+
}): AsyncGenerator<CrawlerPromptEvent, void, undefined>;
|
|
130
|
+
/**
|
|
131
|
+
* Ask a question answered from this crawl's content, the whole answer at once.
|
|
132
|
+
*
|
|
133
|
+
* Sugar over `client.crawlPromptAnswer([uuid], ...)`.
|
|
134
|
+
*/
|
|
135
|
+
promptAnswer(prompt: string, opts?: {
|
|
136
|
+
search?: {
|
|
137
|
+
limit?: number;
|
|
138
|
+
mode?: CrawlerSearchMode;
|
|
139
|
+
filters?: Record<string, any>;
|
|
140
|
+
};
|
|
141
|
+
model?: string;
|
|
142
|
+
}): Promise<CrawlerPromptAnswer>;
|
|
143
|
+
/**
|
|
144
|
+
* Extract a structured object from this crawl's content, shaped by `schema`.
|
|
145
|
+
*
|
|
146
|
+
* Sugar over `client.crawlExtract([uuid], ...)`.
|
|
147
|
+
*/
|
|
148
|
+
extract<T = any>(prompt: string, schema: Record<string, any>, opts?: {
|
|
149
|
+
search?: {
|
|
150
|
+
limit?: number;
|
|
151
|
+
mode?: CrawlerSearchMode;
|
|
152
|
+
filters?: Record<string, any>;
|
|
153
|
+
};
|
|
154
|
+
}): Promise<CrawlerExtractResponse<T>>;
|
|
155
|
+
/**
|
|
156
|
+
* Re-scrape this crawl's URLs in place, right now.
|
|
157
|
+
*
|
|
158
|
+
* Sugar over `client.crawlRefreshNow(uuid)`. The crawl keeps its uuid, its
|
|
159
|
+
* artifacts and its search index; only pages whose content changed are
|
|
160
|
+
* re-indexed and pages that disappeared are dropped.
|
|
161
|
+
*/
|
|
162
|
+
refreshNow(): Promise<CrawlerRefreshState>;
|
|
163
|
+
/**
|
|
164
|
+
* Change this crawl's refresh schedule.
|
|
165
|
+
*
|
|
166
|
+
* Sugar over `client.crawlRefreshSettings(uuid, ...)`; only what is passed
|
|
167
|
+
* is changed.
|
|
168
|
+
*/
|
|
169
|
+
refreshSettings(settings: {
|
|
170
|
+
enabled?: boolean;
|
|
171
|
+
interval_seconds?: number;
|
|
172
|
+
}): Promise<CrawlerRefreshState>;
|
|
173
|
+
/**
|
|
174
|
+
* Read this crawl's refresh timeline, newest last.
|
|
175
|
+
*
|
|
176
|
+
* Sugar over `client.crawlRefreshHistory(uuid, ...)`.
|
|
177
|
+
*/
|
|
178
|
+
refreshHistory(opts?: {
|
|
179
|
+
limit?: number;
|
|
180
|
+
}): Promise<CrawlerRefreshEntry[]>;
|
|
99
181
|
/**
|
|
100
182
|
* Read raw content for a single crawled URL using `plain=true` mode.
|
|
101
183
|
*
|
package/script/crawl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crawl.d.ts","sourceRoot":"","sources":["../src/crawl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,KAAK,EACV,eAAe,EAGf,aAAa,EACb,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,KAAK;IASJ,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAkB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAR5E,OAAO,CAAC,KAAK,CAAC,CAAS;IACvB,OAAO,CAAC,OAAO,CAAC,CAAgB;IAChC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwD;IAEvF;;;OAGG;gBAC0B,MAAM,EAAE,cAAc,EAAmB,MAAM,EAAE,aAAa;IAE3F,iFAAiF;IACjF,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IAED,sEAAsE;IAC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
|
+
/**
|
|
206
|
+
* Search this crawl's index.
|
|
207
|
+
*
|
|
208
|
+
* Sugar over `client.crawlSearch([uuid], ...)`. The cross-crawl call is the
|
|
209
|
+
* real endpoint; both share its implementation so single and multi-crawl
|
|
210
|
+
* search cannot drift.
|
|
211
|
+
*
|
|
212
|
+
* Requires the crawl to have been started with `search: true` and its index
|
|
213
|
+
* to have reached `READY`/`PARTIAL`; poll `CrawlerStatus.search` or
|
|
214
|
+
* subscribe to the `crawler_search_ready` webhook. An index that is not
|
|
215
|
+
* ready yet is reported in the response's `skipped` list, not as an error.
|
|
216
|
+
*/
|
|
217
|
+
async search(query, opts) {
|
|
218
|
+
const uuid = this.requireUuid();
|
|
219
|
+
return await this.client.crawlSearch([uuid], query, opts);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Ask a question answered from this crawl's content.
|
|
223
|
+
*
|
|
224
|
+
* Sugar over `client.crawlPrompt([uuid], ...)`; yields the same frames.
|
|
225
|
+
*/
|
|
226
|
+
prompt(prompt, opts) {
|
|
227
|
+
const uuid = this.requireUuid();
|
|
228
|
+
return this.client.crawlPrompt([uuid], prompt, opts);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Ask a question answered from this crawl's content, the whole answer at once.
|
|
232
|
+
*
|
|
233
|
+
* Sugar over `client.crawlPromptAnswer([uuid], ...)`.
|
|
234
|
+
*/
|
|
235
|
+
async promptAnswer(prompt, opts) {
|
|
236
|
+
const uuid = this.requireUuid();
|
|
237
|
+
return this.client.crawlPromptAnswer([uuid], prompt, opts);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Extract a structured object from this crawl's content, shaped by `schema`.
|
|
241
|
+
*
|
|
242
|
+
* Sugar over `client.crawlExtract([uuid], ...)`.
|
|
243
|
+
*/
|
|
244
|
+
async extract(prompt, schema, opts) {
|
|
245
|
+
const uuid = this.requireUuid();
|
|
246
|
+
return this.client.crawlExtract([uuid], prompt, schema, opts);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Re-scrape this crawl's URLs in place, right now.
|
|
250
|
+
*
|
|
251
|
+
* Sugar over `client.crawlRefreshNow(uuid)`. The crawl keeps its uuid, its
|
|
252
|
+
* artifacts and its search index; only pages whose content changed are
|
|
253
|
+
* re-indexed and pages that disappeared are dropped.
|
|
254
|
+
*/
|
|
255
|
+
async refreshNow() {
|
|
256
|
+
const uuid = this.requireUuid();
|
|
257
|
+
return await this.client.crawlRefreshNow(uuid);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Change this crawl's refresh schedule.
|
|
261
|
+
*
|
|
262
|
+
* Sugar over `client.crawlRefreshSettings(uuid, ...)`; only what is passed
|
|
263
|
+
* is changed.
|
|
264
|
+
*/
|
|
265
|
+
async refreshSettings(settings) {
|
|
266
|
+
const uuid = this.requireUuid();
|
|
267
|
+
return await this.client.crawlRefreshSettings(uuid, settings);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Read this crawl's refresh timeline, newest last.
|
|
271
|
+
*
|
|
272
|
+
* Sugar over `client.crawlRefreshHistory(uuid, ...)`.
|
|
273
|
+
*/
|
|
274
|
+
async refreshHistory(opts) {
|
|
275
|
+
const uuid = this.requireUuid();
|
|
276
|
+
return await this.client.crawlRefreshHistory(uuid, opts);
|
|
277
|
+
}
|
|
205
278
|
/**
|
|
206
279
|
* Read raw content for a single crawled URL using `plain=true` mode.
|
|
207
280
|
*
|
|
@@ -14,10 +14,15 @@ export type CrawlerContentFormat = 'html' | 'clean_html' | 'markdown' | 'text' |
|
|
|
14
14
|
/**
|
|
15
15
|
* Webhook event names emitted by the crawler.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* Event names match the wire format documented in the Crawler API webhook reference.
|
|
18
|
+
* Verified against the public docs and the JSON example payloads.
|
|
19
19
|
*/
|
|
20
|
-
export type CrawlerWebhookEventName = 'crawler_started' | 'crawler_url_visited' | 'crawler_url_skipped' | 'crawler_url_discovered' | 'crawler_url_failed' | 'crawler_stopped' | 'crawler_cancelled' | 'crawler_finished';
|
|
20
|
+
export type CrawlerWebhookEventName = 'crawler_started' | 'crawler_url_visited' | 'crawler_url_skipped' | 'crawler_url_discovered' | 'crawler_url_failed' | 'crawler_stopped' | 'crawler_cancelled' | 'crawler_finished' | 'crawler_search_ready' | 'crawler_search_failed' | 'crawler_updated';
|
|
21
|
+
/**
|
|
22
|
+
* Auto-refresh interval bounds, in seconds (1 hour to 90 days).
|
|
23
|
+
*/
|
|
24
|
+
export declare const REFRESH_MIN_INTERVAL = 3600;
|
|
25
|
+
export declare const REFRESH_MAX_INTERVAL: number;
|
|
21
26
|
/**
|
|
22
27
|
* Constructor options for {@link CrawlerConfig}.
|
|
23
28
|
*
|
|
@@ -52,7 +57,31 @@ export type CrawlerConfigOptions = {
|
|
|
52
57
|
cache_clear?: boolean;
|
|
53
58
|
content_formats?: CrawlerContentFormat[];
|
|
54
59
|
extraction_rules?: Rec<any>;
|
|
60
|
+
search?: boolean;
|
|
61
|
+
refresh?: boolean;
|
|
62
|
+
refresh_interval?: number;
|
|
63
|
+
/**
|
|
64
|
+
* The Unblocker (anti-bot bypass), the current name for what used to be
|
|
65
|
+
* called `asp`. Sent in the `POST /crawl` body as `asp`; only the SDK-facing
|
|
66
|
+
* name changed.
|
|
67
|
+
*
|
|
68
|
+
* @deprecated Use `proxy_pool` (`'unblocker_ultra'` for the Unblocker). The
|
|
69
|
+
* migration guide covers requests written before the proxy pools:
|
|
70
|
+
* https://scrapfly.io/new-pricing#legacy-spellings
|
|
71
|
+
*/
|
|
72
|
+
unblocker?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* @deprecated Alias of {@link CrawlerConfigOptions.unblocker}: use
|
|
75
|
+
* `proxy_pool` (`'unblocker_ultra'` for the Unblocker). When both are
|
|
76
|
+
* supplied `asp` wins, so existing code cannot have its meaning changed by a
|
|
77
|
+
* later `unblocker`.
|
|
78
|
+
*/
|
|
55
79
|
asp?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Proxy pool for every crawled page: `basic`, `unblocker`, `unblocker_ultra`
|
|
82
|
+
* or `auto` (see ScrapeConfig.BASIC), each of which sets the Unblocker
|
|
83
|
+
* itself.
|
|
84
|
+
*/
|
|
56
85
|
proxy_pool?: string;
|
|
57
86
|
country?: string;
|
|
58
87
|
webhook_name?: string;
|
|
@@ -101,12 +130,34 @@ export declare class CrawlerConfig {
|
|
|
101
130
|
cache_clear?: boolean;
|
|
102
131
|
content_formats?: CrawlerContentFormat[];
|
|
103
132
|
extraction_rules?: Rec<any>;
|
|
133
|
+
search?: boolean;
|
|
134
|
+
refresh?: boolean;
|
|
135
|
+
refresh_interval?: number;
|
|
136
|
+
/**
|
|
137
|
+
* Storage for the anti-bot bypass toggle, under its deprecated name.
|
|
138
|
+
* `unblocker` is an accessor over this same field — see below.
|
|
139
|
+
*
|
|
140
|
+
* @deprecated Use `proxy_pool` (`'unblocker_ultra'` for the Unblocker).
|
|
141
|
+
*/
|
|
104
142
|
asp?: boolean;
|
|
105
143
|
proxy_pool?: string;
|
|
106
144
|
country?: string;
|
|
107
145
|
webhook_name?: string;
|
|
108
146
|
webhook_events?: CrawlerWebhookEventName[];
|
|
109
147
|
constructor(options: CrawlerConfigOptions);
|
|
148
|
+
/**
|
|
149
|
+
* The Unblocker toggle, the current name for what used to be `asp`.
|
|
150
|
+
* Deprecated: use `proxy_pool` (`'unblocker_ultra'` for the Unblocker). The
|
|
151
|
+
* migration guide covers requests written before the proxy pools:
|
|
152
|
+
* https://scrapfly.io/new-pricing#legacy-spellings
|
|
153
|
+
*
|
|
154
|
+
* An accessor over the single `asp` field rather than a second stored
|
|
155
|
+
* property: one storage slot means the two names can never disagree, and
|
|
156
|
+
* `toApiParams` keeps serializing the one field under the wire key `asp`.
|
|
157
|
+
* `undefined` propagates in both directions, so "unset" stays unset.
|
|
158
|
+
*/
|
|
159
|
+
get unblocker(): boolean | undefined;
|
|
160
|
+
set unblocker(value: boolean | undefined);
|
|
110
161
|
private validateOptions;
|
|
111
162
|
/**
|
|
112
163
|
* Serialize to a flat object suitable for `JSON.stringify()` as a `POST /crawl` body.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crawlerconfig.d.ts","sourceRoot":"","sources":["../src/crawlerconfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,YAAY,GACZ,UAAU,GACV,MAAM,GACN,MAAM,GACN,gBAAgB,GAChB,eAAe,CAAC;AAYpB;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAC/B,iBAAiB,GACjB,qBAAqB,GACrB,qBAAqB,GACrB,wBAAwB,GACxB,oBAAoB,GACpB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"crawlerconfig.d.ts","sourceRoot":"","sources":["../src/crawlerconfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,YAAY,GACZ,UAAU,GACV,MAAM,GACN,MAAM,GACN,gBAAgB,GAChB,eAAe,CAAC;AAYpB;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAC/B,iBAAiB,GACjB,qBAAqB,GACrB,qBAAqB,GACrB,wBAAwB,GACxB,oBAAoB,GACpB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,GAClB,sBAAsB,GACtB,uBAAuB,GACvB,iBAAiB,CAAC;AAEtB;;GAEG;AACH,eAAO,MAAM,oBAAoB,OAAO,CAAC;AACzC,eAAO,MAAM,oBAAoB,QAAiB,CAAC;AAgBnD;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAIjC,GAAG,CAAC,EAAE,MA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OAAO,CAAC;IAEtB,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACzC,gBAAgB,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAE5B,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,uBAAuB,EAAE,CAAC;gBAE/B,OAAO,EAAE,oBAAoB;IAiIzC;;;;;;;;;;OAUG;IACH,IAAI,SAAS,IAAI,OAAO,GAAG,SAAS,CAEnC;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,EAEvC;IAED,OAAO,CAAC,eAAe;IA8CvB;;;;;;;;;OASG;IACH,WAAW,IAAI,GAAG,CAAC,GAAG,CAAC;CAqExB"}
|
package/script/crawlerconfig.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CrawlerConfig = void 0;
|
|
3
|
+
exports.CrawlerConfig = exports.REFRESH_MAX_INTERVAL = exports.REFRESH_MIN_INTERVAL = void 0;
|
|
4
4
|
const errors_js_1 = require("./errors.js");
|
|
5
5
|
const VALID_CONTENT_FORMATS = new Set([
|
|
6
6
|
'html',
|
|
@@ -11,6 +11,11 @@ const VALID_CONTENT_FORMATS = new Set([
|
|
|
11
11
|
'extracted_data',
|
|
12
12
|
'page_metadata',
|
|
13
13
|
]);
|
|
14
|
+
/**
|
|
15
|
+
* Auto-refresh interval bounds, in seconds (1 hour to 90 days).
|
|
16
|
+
*/
|
|
17
|
+
exports.REFRESH_MIN_INTERVAL = 3600;
|
|
18
|
+
exports.REFRESH_MAX_INTERVAL = 90 * 24 * 3600;
|
|
14
19
|
const VALID_WEBHOOK_EVENTS = new Set([
|
|
15
20
|
'crawler_started',
|
|
16
21
|
'crawler_url_visited',
|
|
@@ -20,6 +25,9 @@ const VALID_WEBHOOK_EVENTS = new Set([
|
|
|
20
25
|
'crawler_stopped',
|
|
21
26
|
'crawler_cancelled',
|
|
22
27
|
'crawler_finished',
|
|
28
|
+
'crawler_search_ready',
|
|
29
|
+
'crawler_search_failed',
|
|
30
|
+
'crawler_updated',
|
|
23
31
|
]);
|
|
24
32
|
/**
|
|
25
33
|
* Configuration for a Scrapfly Crawler API job.
|
|
@@ -200,6 +208,30 @@ class CrawlerConfig {
|
|
|
200
208
|
writable: true,
|
|
201
209
|
value: void 0
|
|
202
210
|
});
|
|
211
|
+
Object.defineProperty(this, "search", {
|
|
212
|
+
enumerable: true,
|
|
213
|
+
configurable: true,
|
|
214
|
+
writable: true,
|
|
215
|
+
value: void 0
|
|
216
|
+
});
|
|
217
|
+
Object.defineProperty(this, "refresh", {
|
|
218
|
+
enumerable: true,
|
|
219
|
+
configurable: true,
|
|
220
|
+
writable: true,
|
|
221
|
+
value: void 0
|
|
222
|
+
});
|
|
223
|
+
Object.defineProperty(this, "refresh_interval", {
|
|
224
|
+
enumerable: true,
|
|
225
|
+
configurable: true,
|
|
226
|
+
writable: true,
|
|
227
|
+
value: void 0
|
|
228
|
+
});
|
|
229
|
+
/**
|
|
230
|
+
* Storage for the anti-bot bypass toggle, under its deprecated name.
|
|
231
|
+
* `unblocker` is an accessor over this same field — see below.
|
|
232
|
+
*
|
|
233
|
+
* @deprecated Use `proxy_pool` (`'unblocker_ultra'` for the Unblocker).
|
|
234
|
+
*/
|
|
203
235
|
Object.defineProperty(this, "asp", {
|
|
204
236
|
enumerable: true,
|
|
205
237
|
configurable: true,
|
|
@@ -285,6 +317,16 @@ class CrawlerConfig {
|
|
|
285
317
|
if (options.allowed_internal_subdomains && options.allowed_internal_subdomains.length > 250) {
|
|
286
318
|
throw new errors_js_1.CrawlerConfigError('allowed_internal_subdomains is limited to 250 entries');
|
|
287
319
|
}
|
|
320
|
+
// The floor decides the cost: a crawl refreshing every minute re-scrapes
|
|
321
|
+
// the whole site 1,440 times a day.
|
|
322
|
+
if (options.refresh_interval !== undefined &&
|
|
323
|
+
(options.refresh_interval < exports.REFRESH_MIN_INTERVAL || options.refresh_interval > exports.REFRESH_MAX_INTERVAL)) {
|
|
324
|
+
throw new errors_js_1.CrawlerConfigError(`refresh_interval must be between ${exports.REFRESH_MIN_INTERVAL} and ${exports.REFRESH_MAX_INTERVAL} (seconds, 1 hour to 90 days)`);
|
|
325
|
+
}
|
|
326
|
+
// A period with the feature off would silently never run.
|
|
327
|
+
if (options.refresh_interval !== undefined && !options.refresh) {
|
|
328
|
+
throw new errors_js_1.CrawlerConfigError('refresh_interval requires refresh: true');
|
|
329
|
+
}
|
|
288
330
|
// Validate content_formats values
|
|
289
331
|
if (options.content_formats) {
|
|
290
332
|
for (const fmt of options.content_formats) {
|
|
@@ -326,12 +368,37 @@ class CrawlerConfig {
|
|
|
326
368
|
this.cache_clear = options.cache_clear;
|
|
327
369
|
this.content_formats = options.content_formats;
|
|
328
370
|
this.extraction_rules = options.extraction_rules;
|
|
329
|
-
this.
|
|
371
|
+
this.search = options.search;
|
|
372
|
+
this.refresh = options.refresh;
|
|
373
|
+
this.refresh_interval = options.refresh_interval;
|
|
374
|
+
// An explicitly supplied `asp` always wins; the deprecated alias is only
|
|
375
|
+
// superseded by `unblocker` when it was not supplied at all. `??` and not
|
|
376
|
+
// `||`, so an explicit `false` on either name still reaches the server.
|
|
377
|
+
// Both unset stays `undefined`, which toApiParams drops so the server
|
|
378
|
+
// applies its own default.
|
|
379
|
+
this.asp = options.asp ?? options.unblocker;
|
|
330
380
|
this.proxy_pool = options.proxy_pool;
|
|
331
381
|
this.country = options.country;
|
|
332
382
|
this.webhook_name = options.webhook_name;
|
|
333
383
|
this.webhook_events = options.webhook_events;
|
|
334
384
|
}
|
|
385
|
+
/**
|
|
386
|
+
* The Unblocker toggle, the current name for what used to be `asp`.
|
|
387
|
+
* Deprecated: use `proxy_pool` (`'unblocker_ultra'` for the Unblocker). The
|
|
388
|
+
* migration guide covers requests written before the proxy pools:
|
|
389
|
+
* https://scrapfly.io/new-pricing#legacy-spellings
|
|
390
|
+
*
|
|
391
|
+
* An accessor over the single `asp` field rather than a second stored
|
|
392
|
+
* property: one storage slot means the two names can never disagree, and
|
|
393
|
+
* `toApiParams` keeps serializing the one field under the wire key `asp`.
|
|
394
|
+
* `undefined` propagates in both directions, so "unset" stays unset.
|
|
395
|
+
*/
|
|
396
|
+
get unblocker() {
|
|
397
|
+
return this.asp;
|
|
398
|
+
}
|
|
399
|
+
set unblocker(value) {
|
|
400
|
+
this.asp = value;
|
|
401
|
+
}
|
|
335
402
|
validateOptions(options) {
|
|
336
403
|
const validKeys = new Set([
|
|
337
404
|
'url',
|
|
@@ -361,6 +428,10 @@ class CrawlerConfig {
|
|
|
361
428
|
'cache_clear',
|
|
362
429
|
'content_formats',
|
|
363
430
|
'extraction_rules',
|
|
431
|
+
'search',
|
|
432
|
+
'refresh',
|
|
433
|
+
'refresh_interval',
|
|
434
|
+
'unblocker',
|
|
364
435
|
'asp',
|
|
365
436
|
'proxy_pool',
|
|
366
437
|
'country',
|
|
@@ -413,7 +484,9 @@ class CrawlerConfig {
|
|
|
413
484
|
'cache_clear',
|
|
414
485
|
'content_formats',
|
|
415
486
|
'extraction_rules',
|
|
416
|
-
'
|
|
487
|
+
'search',
|
|
488
|
+
'refresh',
|
|
489
|
+
'refresh_interval',
|
|
417
490
|
'proxy_pool',
|
|
418
491
|
'country',
|
|
419
492
|
'webhook_name',
|
|
@@ -425,6 +498,27 @@ class CrawlerConfig {
|
|
|
425
498
|
params[key] = v;
|
|
426
499
|
}
|
|
427
500
|
}
|
|
501
|
+
// The anti-bot toggle is serialized apart from the loop above because it is
|
|
502
|
+
// the one field where `false` and "not supplied" must collapse.
|
|
503
|
+
//
|
|
504
|
+
// The key is `asp` and never `unblocker`: the wire key is unchanged for
|
|
505
|
+
// both names. A published package version is immutable and upgraded per
|
|
506
|
+
// installation, so emitting `unblocker` against an API deployment that has
|
|
507
|
+
// not learned that name yet would silently drop a paid feature — the crawl
|
|
508
|
+
// runs, is billed, and comes back blocked. Renaming the emitted key is a
|
|
509
|
+
// separate, later release.
|
|
510
|
+
//
|
|
511
|
+
// Only `true` is emitted. CROSS-SDK SHAPE: the Python, Go and Rust SDKs all
|
|
512
|
+
// omit the key when the feature is off (Python's `asp` is a plain `bool`,
|
|
513
|
+
// Go's is a `bool`, Rust's carries `skip_serializing_if = "is_false"`), so
|
|
514
|
+
// carrying an explicit `asp: false` here would make the same customer
|
|
515
|
+
// intent produce two different POST /crawl bodies depending on which SDK
|
|
516
|
+
// they picked. The API cannot tell the two apart either: it resolves a
|
|
517
|
+
// present-false and an absent pair to the same `false`, so an explicit
|
|
518
|
+
// `asp: false` on the wire buys nothing. One shape, all four SDKs.
|
|
519
|
+
if (this.asp === true) {
|
|
520
|
+
params.asp = true;
|
|
521
|
+
}
|
|
428
522
|
return params;
|
|
429
523
|
}
|
|
430
524
|
}
|