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/esm/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/esm/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;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
|
179
|
+
/**
|
|
180
|
+
* Search this crawl's index.
|
|
181
|
+
*
|
|
182
|
+
* Sugar over `client.crawlSearch([uuid], ...)`. The cross-crawl call is the
|
|
183
|
+
* real endpoint; both share its implementation so single and multi-crawl
|
|
184
|
+
* search cannot drift.
|
|
185
|
+
*
|
|
186
|
+
* Requires the crawl to have been started with `search: true` and its index
|
|
187
|
+
* to have reached `READY`/`PARTIAL`; poll `CrawlerStatus.search` or
|
|
188
|
+
* subscribe to the `crawler_search_ready` webhook. An index that is not
|
|
189
|
+
* ready yet is reported in the response's `skipped` list, not as an error.
|
|
190
|
+
*/
|
|
191
|
+
async search(query, opts) {
|
|
192
|
+
const uuid = this.requireUuid();
|
|
193
|
+
return await this.client.crawlSearch([uuid], query, opts);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Ask a question answered from this crawl's content.
|
|
197
|
+
*
|
|
198
|
+
* Sugar over `client.crawlPrompt([uuid], ...)`; yields the same frames.
|
|
199
|
+
*/
|
|
200
|
+
prompt(prompt, opts) {
|
|
201
|
+
const uuid = this.requireUuid();
|
|
202
|
+
return this.client.crawlPrompt([uuid], prompt, opts);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Ask a question answered from this crawl's content, the whole answer at once.
|
|
206
|
+
*
|
|
207
|
+
* Sugar over `client.crawlPromptAnswer([uuid], ...)`.
|
|
208
|
+
*/
|
|
209
|
+
async promptAnswer(prompt, opts) {
|
|
210
|
+
const uuid = this.requireUuid();
|
|
211
|
+
return this.client.crawlPromptAnswer([uuid], prompt, opts);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Extract a structured object from this crawl's content, shaped by `schema`.
|
|
215
|
+
*
|
|
216
|
+
* Sugar over `client.crawlExtract([uuid], ...)`.
|
|
217
|
+
*/
|
|
218
|
+
async extract(prompt, schema, opts) {
|
|
219
|
+
const uuid = this.requireUuid();
|
|
220
|
+
return this.client.crawlExtract([uuid], prompt, schema, opts);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Re-scrape this crawl's URLs in place, right now.
|
|
224
|
+
*
|
|
225
|
+
* Sugar over `client.crawlRefreshNow(uuid)`. The crawl keeps its uuid, its
|
|
226
|
+
* artifacts and its search index; only pages whose content changed are
|
|
227
|
+
* re-indexed and pages that disappeared are dropped.
|
|
228
|
+
*/
|
|
229
|
+
async refreshNow() {
|
|
230
|
+
const uuid = this.requireUuid();
|
|
231
|
+
return await this.client.crawlRefreshNow(uuid);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Change this crawl's refresh schedule.
|
|
235
|
+
*
|
|
236
|
+
* Sugar over `client.crawlRefreshSettings(uuid, ...)`; only what is passed
|
|
237
|
+
* is changed.
|
|
238
|
+
*/
|
|
239
|
+
async refreshSettings(settings) {
|
|
240
|
+
const uuid = this.requireUuid();
|
|
241
|
+
return await this.client.crawlRefreshSettings(uuid, settings);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Read this crawl's refresh timeline, newest last.
|
|
245
|
+
*
|
|
246
|
+
* Sugar over `client.crawlRefreshHistory(uuid, ...)`.
|
|
247
|
+
*/
|
|
248
|
+
async refreshHistory(opts) {
|
|
249
|
+
const uuid = this.requireUuid();
|
|
250
|
+
return await this.client.crawlRefreshHistory(uuid, opts);
|
|
251
|
+
}
|
|
179
252
|
/**
|
|
180
253
|
* Read raw content for a single crawled URL using `plain=true` mode.
|
|
181
254
|
*
|
package/esm/crawlerconfig.d.ts
CHANGED
|
@@ -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,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AM,CAAC;IACnB,WAAW,CAAC,EAAE,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/esm/crawlerconfig.js
CHANGED
|
@@ -8,6 +8,11 @@ const VALID_CONTENT_FORMATS = new Set([
|
|
|
8
8
|
'extracted_data',
|
|
9
9
|
'page_metadata',
|
|
10
10
|
]);
|
|
11
|
+
/**
|
|
12
|
+
* Auto-refresh interval bounds, in seconds (1 hour to 90 days).
|
|
13
|
+
*/
|
|
14
|
+
export const REFRESH_MIN_INTERVAL = 3600;
|
|
15
|
+
export const REFRESH_MAX_INTERVAL = 90 * 24 * 3600;
|
|
11
16
|
const VALID_WEBHOOK_EVENTS = new Set([
|
|
12
17
|
'crawler_started',
|
|
13
18
|
'crawler_url_visited',
|
|
@@ -17,6 +22,9 @@ const VALID_WEBHOOK_EVENTS = new Set([
|
|
|
17
22
|
'crawler_stopped',
|
|
18
23
|
'crawler_cancelled',
|
|
19
24
|
'crawler_finished',
|
|
25
|
+
'crawler_search_ready',
|
|
26
|
+
'crawler_search_failed',
|
|
27
|
+
'crawler_updated',
|
|
20
28
|
]);
|
|
21
29
|
/**
|
|
22
30
|
* Configuration for a Scrapfly Crawler API job.
|
|
@@ -197,6 +205,30 @@ export class CrawlerConfig {
|
|
|
197
205
|
writable: true,
|
|
198
206
|
value: void 0
|
|
199
207
|
});
|
|
208
|
+
Object.defineProperty(this, "search", {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
configurable: true,
|
|
211
|
+
writable: true,
|
|
212
|
+
value: void 0
|
|
213
|
+
});
|
|
214
|
+
Object.defineProperty(this, "refresh", {
|
|
215
|
+
enumerable: true,
|
|
216
|
+
configurable: true,
|
|
217
|
+
writable: true,
|
|
218
|
+
value: void 0
|
|
219
|
+
});
|
|
220
|
+
Object.defineProperty(this, "refresh_interval", {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
configurable: true,
|
|
223
|
+
writable: true,
|
|
224
|
+
value: void 0
|
|
225
|
+
});
|
|
226
|
+
/**
|
|
227
|
+
* Storage for the anti-bot bypass toggle, under its deprecated name.
|
|
228
|
+
* `unblocker` is an accessor over this same field — see below.
|
|
229
|
+
*
|
|
230
|
+
* @deprecated Use `proxy_pool` (`'unblocker_ultra'` for the Unblocker).
|
|
231
|
+
*/
|
|
200
232
|
Object.defineProperty(this, "asp", {
|
|
201
233
|
enumerable: true,
|
|
202
234
|
configurable: true,
|
|
@@ -282,6 +314,16 @@ export class CrawlerConfig {
|
|
|
282
314
|
if (options.allowed_internal_subdomains && options.allowed_internal_subdomains.length > 250) {
|
|
283
315
|
throw new CrawlerConfigError('allowed_internal_subdomains is limited to 250 entries');
|
|
284
316
|
}
|
|
317
|
+
// The floor decides the cost: a crawl refreshing every minute re-scrapes
|
|
318
|
+
// the whole site 1,440 times a day.
|
|
319
|
+
if (options.refresh_interval !== undefined &&
|
|
320
|
+
(options.refresh_interval < REFRESH_MIN_INTERVAL || options.refresh_interval > REFRESH_MAX_INTERVAL)) {
|
|
321
|
+
throw new CrawlerConfigError(`refresh_interval must be between ${REFRESH_MIN_INTERVAL} and ${REFRESH_MAX_INTERVAL} (seconds, 1 hour to 90 days)`);
|
|
322
|
+
}
|
|
323
|
+
// A period with the feature off would silently never run.
|
|
324
|
+
if (options.refresh_interval !== undefined && !options.refresh) {
|
|
325
|
+
throw new CrawlerConfigError('refresh_interval requires refresh: true');
|
|
326
|
+
}
|
|
285
327
|
// Validate content_formats values
|
|
286
328
|
if (options.content_formats) {
|
|
287
329
|
for (const fmt of options.content_formats) {
|
|
@@ -323,12 +365,37 @@ export class CrawlerConfig {
|
|
|
323
365
|
this.cache_clear = options.cache_clear;
|
|
324
366
|
this.content_formats = options.content_formats;
|
|
325
367
|
this.extraction_rules = options.extraction_rules;
|
|
326
|
-
this.
|
|
368
|
+
this.search = options.search;
|
|
369
|
+
this.refresh = options.refresh;
|
|
370
|
+
this.refresh_interval = options.refresh_interval;
|
|
371
|
+
// An explicitly supplied `asp` always wins; the deprecated alias is only
|
|
372
|
+
// superseded by `unblocker` when it was not supplied at all. `??` and not
|
|
373
|
+
// `||`, so an explicit `false` on either name still reaches the server.
|
|
374
|
+
// Both unset stays `undefined`, which toApiParams drops so the server
|
|
375
|
+
// applies its own default.
|
|
376
|
+
this.asp = options.asp ?? options.unblocker;
|
|
327
377
|
this.proxy_pool = options.proxy_pool;
|
|
328
378
|
this.country = options.country;
|
|
329
379
|
this.webhook_name = options.webhook_name;
|
|
330
380
|
this.webhook_events = options.webhook_events;
|
|
331
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* The Unblocker toggle, the current name for what used to be `asp`.
|
|
384
|
+
* Deprecated: use `proxy_pool` (`'unblocker_ultra'` for the Unblocker). The
|
|
385
|
+
* migration guide covers requests written before the proxy pools:
|
|
386
|
+
* https://scrapfly.io/new-pricing#legacy-spellings
|
|
387
|
+
*
|
|
388
|
+
* An accessor over the single `asp` field rather than a second stored
|
|
389
|
+
* property: one storage slot means the two names can never disagree, and
|
|
390
|
+
* `toApiParams` keeps serializing the one field under the wire key `asp`.
|
|
391
|
+
* `undefined` propagates in both directions, so "unset" stays unset.
|
|
392
|
+
*/
|
|
393
|
+
get unblocker() {
|
|
394
|
+
return this.asp;
|
|
395
|
+
}
|
|
396
|
+
set unblocker(value) {
|
|
397
|
+
this.asp = value;
|
|
398
|
+
}
|
|
332
399
|
validateOptions(options) {
|
|
333
400
|
const validKeys = new Set([
|
|
334
401
|
'url',
|
|
@@ -358,6 +425,10 @@ export class CrawlerConfig {
|
|
|
358
425
|
'cache_clear',
|
|
359
426
|
'content_formats',
|
|
360
427
|
'extraction_rules',
|
|
428
|
+
'search',
|
|
429
|
+
'refresh',
|
|
430
|
+
'refresh_interval',
|
|
431
|
+
'unblocker',
|
|
361
432
|
'asp',
|
|
362
433
|
'proxy_pool',
|
|
363
434
|
'country',
|
|
@@ -410,7 +481,9 @@ export class CrawlerConfig {
|
|
|
410
481
|
'cache_clear',
|
|
411
482
|
'content_formats',
|
|
412
483
|
'extraction_rules',
|
|
413
|
-
'
|
|
484
|
+
'search',
|
|
485
|
+
'refresh',
|
|
486
|
+
'refresh_interval',
|
|
414
487
|
'proxy_pool',
|
|
415
488
|
'country',
|
|
416
489
|
'webhook_name',
|
|
@@ -422,6 +495,27 @@ export class CrawlerConfig {
|
|
|
422
495
|
params[key] = v;
|
|
423
496
|
}
|
|
424
497
|
}
|
|
498
|
+
// The anti-bot toggle is serialized apart from the loop above because it is
|
|
499
|
+
// the one field where `false` and "not supplied" must collapse.
|
|
500
|
+
//
|
|
501
|
+
// The key is `asp` and never `unblocker`: the wire key is unchanged for
|
|
502
|
+
// both names. A published package version is immutable and upgraded per
|
|
503
|
+
// installation, so emitting `unblocker` against an API deployment that has
|
|
504
|
+
// not learned that name yet would silently drop a paid feature — the crawl
|
|
505
|
+
// runs, is billed, and comes back blocked. Renaming the emitted key is a
|
|
506
|
+
// separate, later release.
|
|
507
|
+
//
|
|
508
|
+
// Only `true` is emitted. CROSS-SDK SHAPE: the Python, Go and Rust SDKs all
|
|
509
|
+
// omit the key when the feature is off (Python's `asp` is a plain `bool`,
|
|
510
|
+
// Go's is a `bool`, Rust's carries `skip_serializing_if = "is_false"`), so
|
|
511
|
+
// carrying an explicit `asp: false` here would make the same customer
|
|
512
|
+
// intent produce two different POST /crawl bodies depending on which SDK
|
|
513
|
+
// they picked. The API cannot tell the two apart either: it resolves a
|
|
514
|
+
// present-false and an absent pair to the same `false`, so an explicit
|
|
515
|
+
// `asp: false` on the wire buys nothing. One shape, all four SDKs.
|
|
516
|
+
if (this.asp === true) {
|
|
517
|
+
params.asp = true;
|
|
518
|
+
}
|
|
425
519
|
return params;
|
|
426
520
|
}
|
|
427
521
|
}
|