scrapfly-sdk 0.6.6 → 0.6.7
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/esm/extractionconfig.d.ts +2 -2
- package/esm/extractionconfig.d.ts.map +1 -1
- package/esm/extractionconfig.js +3 -0
- package/esm/scrapeconfig.d.ts +8 -7
- package/esm/scrapeconfig.d.ts.map +1 -1
- package/esm/scrapeconfig.js +11 -3
- package/esm/screenshotconfig.d.ts +4 -4
- package/esm/screenshotconfig.d.ts.map +1 -1
- package/esm/screenshotconfig.js +2 -3
- package/package.json +1 -1
- package/script/extractionconfig.d.ts +2 -2
- package/script/extractionconfig.d.ts.map +1 -1
- package/script/extractionconfig.js +3 -0
- package/script/scrapeconfig.d.ts +8 -7
- package/script/scrapeconfig.d.ts.map +1 -1
- package/script/scrapeconfig.js +11 -3
- package/script/screenshotconfig.d.ts +4 -4
- package/script/screenshotconfig.d.ts.map +1 -1
- package/script/screenshotconfig.js +2 -3
|
@@ -22,7 +22,7 @@ type ExtractionConfigOptions = {
|
|
|
22
22
|
extraction_prompt?: string;
|
|
23
23
|
extraction_model?: string;
|
|
24
24
|
is_document_compressed?: boolean;
|
|
25
|
-
document_compression_format?: CompressionFormat;
|
|
25
|
+
document_compression_format?: 'gzip' | 'zstd' | 'deflate' | CompressionFormat;
|
|
26
26
|
webhook?: string;
|
|
27
27
|
};
|
|
28
28
|
export declare class ExtractionConfig {
|
|
@@ -35,7 +35,7 @@ export declare class ExtractionConfig {
|
|
|
35
35
|
extraction_prompt?: string;
|
|
36
36
|
extraction_model?: string;
|
|
37
37
|
is_document_compressed?: boolean;
|
|
38
|
-
document_compression_format?: CompressionFormat;
|
|
38
|
+
document_compression_format?: 'gzip' | 'zstd' | 'deflate' | CompressionFormat;
|
|
39
39
|
webhook?: string;
|
|
40
40
|
constructor(options: ExtractionConfigOptions);
|
|
41
41
|
private validateOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractionconfig.d.ts","sourceRoot":"","sources":["../src/extractionconfig.ts"],"names":[],"mappings":"AAGA,oBAAY,iBAAiB;IAC3B;;;;;;;;SAQK;IACL,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,2BAA2B,CAAC,EAAE,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"extractionconfig.d.ts","sourceRoot":"","sources":["../src/extractionconfig.ts"],"names":[],"mappings":"AAGA,oBAAY,iBAAiB;IAC3B;;;;;;;;SAQK;IACL,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,2BAA2B,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAAC;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qBAAa,gBAAgB;IAC3B,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,2BAA2B,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAAC;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEL,OAAO,EAAE,uBAAuB;IAkB5C,OAAO,CAAC,eAAe;IASvB,WAAW,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAiE3D"}
|
package/esm/extractionconfig.js
CHANGED
|
@@ -84,6 +84,9 @@ export class ExtractionConfig {
|
|
|
84
84
|
value: void 0
|
|
85
85
|
});
|
|
86
86
|
this.validateOptions(options);
|
|
87
|
+
if (options.document_compression_format && !Object.values(CompressionFormat).includes(options.document_compression_format)) {
|
|
88
|
+
throw new errors.ExtractionConfigError(`Invalid CompressionFormat param value: ${options.document_compression_format}`);
|
|
89
|
+
}
|
|
87
90
|
this.body = options.body;
|
|
88
91
|
this.content_type = options.content_type;
|
|
89
92
|
this.url = options.url ?? this.url;
|
package/esm/scrapeconfig.d.ts
CHANGED
|
@@ -31,7 +31,8 @@ export declare enum Format {
|
|
|
31
31
|
}
|
|
32
32
|
export declare enum FormatOption {
|
|
33
33
|
NO_LINKS = "no_links",
|
|
34
|
-
NO_IMAGES = "no_images"
|
|
34
|
+
NO_IMAGES = "no_images",
|
|
35
|
+
ONLY_CONTENT = "only_content"
|
|
35
36
|
}
|
|
36
37
|
type ScrapeConfigOptions = {
|
|
37
38
|
url: string;
|
|
@@ -51,8 +52,8 @@ type ScrapeConfigOptions = {
|
|
|
51
52
|
proxy_pool?: string;
|
|
52
53
|
session?: string;
|
|
53
54
|
tags?: string[];
|
|
54
|
-
format?: Format;
|
|
55
|
-
format_options?: FormatOption[];
|
|
55
|
+
format?: 'json' | 'text' | 'markdown' | 'clean_html' | 'raw' | Format;
|
|
56
|
+
format_options?: ('no_links' | 'no_images' | 'only_content' | FormatOption)[];
|
|
56
57
|
correlation_id?: string;
|
|
57
58
|
cookies?: Rec<string>;
|
|
58
59
|
body?: string;
|
|
@@ -62,7 +63,7 @@ type ScrapeConfigOptions = {
|
|
|
62
63
|
rendering_wait?: number;
|
|
63
64
|
wait_for_selector?: string;
|
|
64
65
|
screenshots?: Rec<any>;
|
|
65
|
-
screenshot_flags?: ScreenshotFlags[];
|
|
66
|
+
screenshot_flags?: ('load_images' | 'dark_mode' | 'block_banners' | 'print_media_format' | 'high_quality' | ScreenshotFlags)[];
|
|
66
67
|
session_sticky_proxy?: boolean;
|
|
67
68
|
webhook?: string;
|
|
68
69
|
timeout?: number;
|
|
@@ -91,8 +92,8 @@ export declare class ScrapeConfig {
|
|
|
91
92
|
proxy_pool?: string;
|
|
92
93
|
session?: string;
|
|
93
94
|
tags: Set<string>;
|
|
94
|
-
format?: Format;
|
|
95
|
-
format_options?: FormatOption[];
|
|
95
|
+
format?: 'json' | 'text' | 'markdown' | 'clean_html' | 'raw' | Format;
|
|
96
|
+
format_options?: ('no_links' | 'no_images' | 'only_content' | FormatOption)[];
|
|
96
97
|
correlation_id?: string;
|
|
97
98
|
cookies?: Rec<string>;
|
|
98
99
|
body?: string;
|
|
@@ -103,7 +104,7 @@ export declare class ScrapeConfig {
|
|
|
103
104
|
wait_for_selector?: string;
|
|
104
105
|
session_sticky_proxy: boolean;
|
|
105
106
|
screenshots?: Rec<any>;
|
|
106
|
-
screenshot_flags?: ScreenshotFlags[];
|
|
107
|
+
screenshot_flags?: ('load_images' | 'dark_mode' | 'block_banners' | 'print_media_format' | 'high_quality' | ScreenshotFlags)[];
|
|
107
108
|
webhook?: string;
|
|
108
109
|
timeout?: number;
|
|
109
110
|
js_scenario?: Rec<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrapeconfig.d.ts","sourceRoot":"","sources":["../src/scrapeconfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGlD,oBAAY,eAAe;IACzB;;;;;;;QAOI;IACJ,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;IACzC,YAAY,iBAAiB;CAC9B;AAED,oBAAY,MAAM;IAChB;;;;;;;QAOI;IACJ,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,GAAG,QAAQ;CACZ;AAED,oBAAY,YAAY;IACtB,QAAQ,aAAa;IACrB,SAAS,cAAc;
|
|
1
|
+
{"version":3,"file":"scrapeconfig.d.ts","sourceRoot":"","sources":["../src/scrapeconfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGlD,oBAAY,eAAe;IACzB;;;;;;;QAOI;IACJ,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;IACzC,YAAY,iBAAiB;CAC9B;AAED,oBAAY,MAAM;IAChB;;;;;;;QAOI;IACJ,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,GAAG,QAAQ;CACZ;AAED,oBAAY,YAAY;IACtB,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,YAAY,iBAAiB;CAC9B;AAED,KAAK,mBAAmB,GAAG;IACzB,GAAG,EAAE,MAAM,C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IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,UAAS;IAC7B,WAAW,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,gBAAgB,CAAC,EAAE,CAAC,aAAa,GAAG,WAAW,GAAG,eAAe,GAAG,oBAAoB,GAAG,cAAc,GAAG,eAAe,CAAC,EAAE,CAAC;IAC/H,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;gBAEV,OAAO,EAAE,mBAAmB;IAuFxC,OAAO,CAAC,eAAe;IASvB,WAAW,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAmJ3D"}
|
package/esm/scrapeconfig.js
CHANGED
|
@@ -37,6 +37,7 @@ export var FormatOption;
|
|
|
37
37
|
(function (FormatOption) {
|
|
38
38
|
FormatOption["NO_LINKS"] = "no_links";
|
|
39
39
|
FormatOption["NO_IMAGES"] = "no_images";
|
|
40
|
+
FormatOption["ONLY_CONTENT"] = "only_content";
|
|
40
41
|
})(FormatOption || (FormatOption = {}));
|
|
41
42
|
export class ScrapeConfig {
|
|
42
43
|
constructor(options) {
|
|
@@ -147,7 +148,7 @@ export class ScrapeConfig {
|
|
|
147
148
|
configurable: true,
|
|
148
149
|
writable: true,
|
|
149
150
|
value: void 0
|
|
150
|
-
});
|
|
151
|
+
});
|
|
151
152
|
Object.defineProperty(this, "format_options", {
|
|
152
153
|
enumerable: true,
|
|
153
154
|
configurable: true,
|
|
@@ -258,13 +259,20 @@ export class ScrapeConfig {
|
|
|
258
259
|
});
|
|
259
260
|
this.validateOptions(options);
|
|
260
261
|
if (options.format && !Object.values(Format).includes(options.format)) {
|
|
261
|
-
throw new ScrapeConfigError(`Invalid
|
|
262
|
+
throw new ScrapeConfigError(`Invalid Format param value: ${options.format}`);
|
|
262
263
|
}
|
|
263
264
|
this.format = options.format ?? this.format;
|
|
265
|
+
if (options.format_options) {
|
|
266
|
+
options.format_options.forEach((flag) => {
|
|
267
|
+
if (!Object.values(FormatOption).includes(flag)) {
|
|
268
|
+
throw new ScrapeConfigError(`Invalid FormatOption param value: ${flag}`);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
264
272
|
if (options.screenshot_flags) {
|
|
265
273
|
options.screenshot_flags.forEach((flag) => {
|
|
266
274
|
if (!Object.values(ScreenshotFlags).includes(flag)) {
|
|
267
|
-
throw new ScrapeConfigError(`Invalid
|
|
275
|
+
throw new ScrapeConfigError(`Invalid ScreenshotFlags param value: ${flag}`);
|
|
268
276
|
}
|
|
269
277
|
});
|
|
270
278
|
}
|
|
@@ -28,14 +28,14 @@ export declare enum Format {
|
|
|
28
28
|
}
|
|
29
29
|
type ScreenshotConfigOptions = {
|
|
30
30
|
url: string;
|
|
31
|
-
format?: Format;
|
|
31
|
+
format?: 'jpg' | 'png' | 'webp' | 'gif' | Format;
|
|
32
32
|
capture?: string;
|
|
33
33
|
resolution?: string;
|
|
34
34
|
country?: string;
|
|
35
35
|
timeout?: number;
|
|
36
36
|
rendering_wait?: number;
|
|
37
37
|
wait_for_selector?: string;
|
|
38
|
-
options?: Options[];
|
|
38
|
+
options?: ('load_images' | 'dark_mode' | 'block_banners' | 'print_media_format' | Options)[];
|
|
39
39
|
auto_scroll?: boolean;
|
|
40
40
|
js?: string;
|
|
41
41
|
cache?: boolean;
|
|
@@ -45,14 +45,14 @@ type ScreenshotConfigOptions = {
|
|
|
45
45
|
};
|
|
46
46
|
export declare class ScreenshotConfig {
|
|
47
47
|
url: string;
|
|
48
|
-
format?: Format;
|
|
48
|
+
format?: 'jpg' | 'png' | 'webp' | 'gif' | Format;
|
|
49
49
|
capture?: string;
|
|
50
50
|
resolution?: string;
|
|
51
51
|
country?: string;
|
|
52
52
|
timeout?: number;
|
|
53
53
|
rendering_wait?: number;
|
|
54
54
|
wait_for_selector?: string;
|
|
55
|
-
options?: Options[];
|
|
55
|
+
options?: ('load_images' | 'dark_mode' | 'block_banners' | 'print_media_format' | Options)[];
|
|
56
56
|
auto_scroll?: boolean;
|
|
57
57
|
js?: string;
|
|
58
58
|
cache?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshotconfig.d.ts","sourceRoot":"","sources":["../src/screenshotconfig.ts"],"names":[],"mappings":"AAIA,oBAAY,OAAO;IACjB;;;;;;;QAOI;IACJ,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;CAC1C;AAED,oBAAY,MAAM;IAChB;;;;;;;QAOI;IACJ,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ;AAED,KAAK,uBAAuB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"screenshotconfig.d.ts","sourceRoot":"","sources":["../src/screenshotconfig.ts"],"names":[],"mappings":"AAIA,oBAAY,OAAO;IACjB;;;;;;;QAOI;IACJ,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;CAC1C;AAED,oBAAY,MAAM;IAChB;;;;;;;QAOI;IACJ,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;IACb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AAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEL,OAAO,EAAE,uBAAuB;IA8B5C,OAAO,CAAC,eAAe;IASvB,WAAW,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAqE3D"}
|
package/esm/screenshotconfig.js
CHANGED
|
@@ -125,14 +125,13 @@ export class ScreenshotConfig {
|
|
|
125
125
|
});
|
|
126
126
|
this.validateOptions(options);
|
|
127
127
|
if (options.format && !Object.values(Format).includes(options.format)) {
|
|
128
|
-
throw new ScreenshotConfigError(`Invalid
|
|
128
|
+
throw new ScreenshotConfigError(`Invalid Format param value: ${options.format}`);
|
|
129
129
|
}
|
|
130
130
|
this.format = options.format ?? this.format;
|
|
131
|
-
// Validate options against the enum
|
|
132
131
|
if (options.options) {
|
|
133
132
|
options.options.forEach((opt) => {
|
|
134
133
|
if (!Object.values(Options).includes(opt)) {
|
|
135
|
-
throw new ScreenshotConfigError(`Invalid
|
|
134
|
+
throw new ScreenshotConfigError(`Invalid Options param value: ${opt}`);
|
|
136
135
|
}
|
|
137
136
|
});
|
|
138
137
|
}
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@ type ExtractionConfigOptions = {
|
|
|
22
22
|
extraction_prompt?: string;
|
|
23
23
|
extraction_model?: string;
|
|
24
24
|
is_document_compressed?: boolean;
|
|
25
|
-
document_compression_format?: CompressionFormat;
|
|
25
|
+
document_compression_format?: 'gzip' | 'zstd' | 'deflate' | CompressionFormat;
|
|
26
26
|
webhook?: string;
|
|
27
27
|
};
|
|
28
28
|
export declare class ExtractionConfig {
|
|
@@ -35,7 +35,7 @@ export declare class ExtractionConfig {
|
|
|
35
35
|
extraction_prompt?: string;
|
|
36
36
|
extraction_model?: string;
|
|
37
37
|
is_document_compressed?: boolean;
|
|
38
|
-
document_compression_format?: CompressionFormat;
|
|
38
|
+
document_compression_format?: 'gzip' | 'zstd' | 'deflate' | CompressionFormat;
|
|
39
39
|
webhook?: string;
|
|
40
40
|
constructor(options: ExtractionConfigOptions);
|
|
41
41
|
private validateOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractionconfig.d.ts","sourceRoot":"","sources":["../src/extractionconfig.ts"],"names":[],"mappings":"AAGA,oBAAY,iBAAiB;IAC3B;;;;;;;;SAQK;IACL,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,2BAA2B,CAAC,EAAE,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"extractionconfig.d.ts","sourceRoot":"","sources":["../src/extractionconfig.ts"],"names":[],"mappings":"AAGA,oBAAY,iBAAiB;IAC3B;;;;;;;;SAQK;IACL,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,2BAA2B,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAAC;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qBAAa,gBAAgB;IAC3B,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,2BAA2B,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAAC;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEL,OAAO,EAAE,uBAAuB;IAkB5C,OAAO,CAAC,eAAe;IASvB,WAAW,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAiE3D"}
|
|
@@ -110,6 +110,9 @@ class ExtractionConfig {
|
|
|
110
110
|
value: void 0
|
|
111
111
|
});
|
|
112
112
|
this.validateOptions(options);
|
|
113
|
+
if (options.document_compression_format && !Object.values(CompressionFormat).includes(options.document_compression_format)) {
|
|
114
|
+
throw new errors.ExtractionConfigError(`Invalid CompressionFormat param value: ${options.document_compression_format}`);
|
|
115
|
+
}
|
|
113
116
|
this.body = options.body;
|
|
114
117
|
this.content_type = options.content_type;
|
|
115
118
|
this.url = options.url ?? this.url;
|
package/script/scrapeconfig.d.ts
CHANGED
|
@@ -31,7 +31,8 @@ export declare enum Format {
|
|
|
31
31
|
}
|
|
32
32
|
export declare enum FormatOption {
|
|
33
33
|
NO_LINKS = "no_links",
|
|
34
|
-
NO_IMAGES = "no_images"
|
|
34
|
+
NO_IMAGES = "no_images",
|
|
35
|
+
ONLY_CONTENT = "only_content"
|
|
35
36
|
}
|
|
36
37
|
type ScrapeConfigOptions = {
|
|
37
38
|
url: string;
|
|
@@ -51,8 +52,8 @@ type ScrapeConfigOptions = {
|
|
|
51
52
|
proxy_pool?: string;
|
|
52
53
|
session?: string;
|
|
53
54
|
tags?: string[];
|
|
54
|
-
format?: Format;
|
|
55
|
-
format_options?: FormatOption[];
|
|
55
|
+
format?: 'json' | 'text' | 'markdown' | 'clean_html' | 'raw' | Format;
|
|
56
|
+
format_options?: ('no_links' | 'no_images' | 'only_content' | FormatOption)[];
|
|
56
57
|
correlation_id?: string;
|
|
57
58
|
cookies?: Rec<string>;
|
|
58
59
|
body?: string;
|
|
@@ -62,7 +63,7 @@ type ScrapeConfigOptions = {
|
|
|
62
63
|
rendering_wait?: number;
|
|
63
64
|
wait_for_selector?: string;
|
|
64
65
|
screenshots?: Rec<any>;
|
|
65
|
-
screenshot_flags?: ScreenshotFlags[];
|
|
66
|
+
screenshot_flags?: ('load_images' | 'dark_mode' | 'block_banners' | 'print_media_format' | 'high_quality' | ScreenshotFlags)[];
|
|
66
67
|
session_sticky_proxy?: boolean;
|
|
67
68
|
webhook?: string;
|
|
68
69
|
timeout?: number;
|
|
@@ -91,8 +92,8 @@ export declare class ScrapeConfig {
|
|
|
91
92
|
proxy_pool?: string;
|
|
92
93
|
session?: string;
|
|
93
94
|
tags: Set<string>;
|
|
94
|
-
format?: Format;
|
|
95
|
-
format_options?: FormatOption[];
|
|
95
|
+
format?: 'json' | 'text' | 'markdown' | 'clean_html' | 'raw' | Format;
|
|
96
|
+
format_options?: ('no_links' | 'no_images' | 'only_content' | FormatOption)[];
|
|
96
97
|
correlation_id?: string;
|
|
97
98
|
cookies?: Rec<string>;
|
|
98
99
|
body?: string;
|
|
@@ -103,7 +104,7 @@ export declare class ScrapeConfig {
|
|
|
103
104
|
wait_for_selector?: string;
|
|
104
105
|
session_sticky_proxy: boolean;
|
|
105
106
|
screenshots?: Rec<any>;
|
|
106
|
-
screenshot_flags?: ScreenshotFlags[];
|
|
107
|
+
screenshot_flags?: ('load_images' | 'dark_mode' | 'block_banners' | 'print_media_format' | 'high_quality' | ScreenshotFlags)[];
|
|
107
108
|
webhook?: string;
|
|
108
109
|
timeout?: number;
|
|
109
110
|
js_scenario?: Rec<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrapeconfig.d.ts","sourceRoot":"","sources":["../src/scrapeconfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGlD,oBAAY,eAAe;IACzB;;;;;;;QAOI;IACJ,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;IACzC,YAAY,iBAAiB;CAC9B;AAED,oBAAY,MAAM;IAChB;;;;;;;QAOI;IACJ,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,GAAG,QAAQ;CACZ;AAED,oBAAY,YAAY;IACtB,QAAQ,aAAa;IACrB,SAAS,cAAc;
|
|
1
|
+
{"version":3,"file":"scrapeconfig.d.ts","sourceRoot":"","sources":["../src/scrapeconfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGlD,oBAAY,eAAe;IACzB;;;;;;;QAOI;IACJ,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;IACzC,YAAY,iBAAiB;CAC9B;AAED,oBAAY,MAAM;IAChB;;;;;;;QAO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
FormatOption["ONLY_CONTENT"] = "only_content";
|
|
43
44
|
})(FormatOption || (exports.FormatOption = FormatOption = {}));
|
|
44
45
|
class ScrapeConfig {
|
|
45
46
|
constructor(options) {
|
|
@@ -150,7 +151,7 @@ class ScrapeConfig {
|
|
|
150
151
|
configurable: true,
|
|
151
152
|
writable: true,
|
|
152
153
|
value: void 0
|
|
153
|
-
});
|
|
154
|
+
});
|
|
154
155
|
Object.defineProperty(this, "format_options", {
|
|
155
156
|
enumerable: true,
|
|
156
157
|
configurable: true,
|
|
@@ -261,13 +262,20 @@ class ScrapeConfig {
|
|
|
261
262
|
});
|
|
262
263
|
this.validateOptions(options);
|
|
263
264
|
if (options.format && !Object.values(Format).includes(options.format)) {
|
|
264
|
-
throw new errors_js_1.ScrapeConfigError(`Invalid
|
|
265
|
+
throw new errors_js_1.ScrapeConfigError(`Invalid Format param value: ${options.format}`);
|
|
265
266
|
}
|
|
266
267
|
this.format = options.format ?? this.format;
|
|
268
|
+
if (options.format_options) {
|
|
269
|
+
options.format_options.forEach((flag) => {
|
|
270
|
+
if (!Object.values(FormatOption).includes(flag)) {
|
|
271
|
+
throw new errors_js_1.ScrapeConfigError(`Invalid FormatOption param value: ${flag}`);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
267
275
|
if (options.screenshot_flags) {
|
|
268
276
|
options.screenshot_flags.forEach((flag) => {
|
|
269
277
|
if (!Object.values(ScreenshotFlags).includes(flag)) {
|
|
270
|
-
throw new errors_js_1.ScrapeConfigError(`Invalid
|
|
278
|
+
throw new errors_js_1.ScrapeConfigError(`Invalid ScreenshotFlags param value: ${flag}`);
|
|
271
279
|
}
|
|
272
280
|
});
|
|
273
281
|
}
|
|
@@ -28,14 +28,14 @@ export declare enum Format {
|
|
|
28
28
|
}
|
|
29
29
|
type ScreenshotConfigOptions = {
|
|
30
30
|
url: string;
|
|
31
|
-
format?: Format;
|
|
31
|
+
format?: 'jpg' | 'png' | 'webp' | 'gif' | Format;
|
|
32
32
|
capture?: string;
|
|
33
33
|
resolution?: string;
|
|
34
34
|
country?: string;
|
|
35
35
|
timeout?: number;
|
|
36
36
|
rendering_wait?: number;
|
|
37
37
|
wait_for_selector?: string;
|
|
38
|
-
options?: Options[];
|
|
38
|
+
options?: ('load_images' | 'dark_mode' | 'block_banners' | 'print_media_format' | Options)[];
|
|
39
39
|
auto_scroll?: boolean;
|
|
40
40
|
js?: string;
|
|
41
41
|
cache?: boolean;
|
|
@@ -45,14 +45,14 @@ type ScreenshotConfigOptions = {
|
|
|
45
45
|
};
|
|
46
46
|
export declare class ScreenshotConfig {
|
|
47
47
|
url: string;
|
|
48
|
-
format?: Format;
|
|
48
|
+
format?: 'jpg' | 'png' | 'webp' | 'gif' | Format;
|
|
49
49
|
capture?: string;
|
|
50
50
|
resolution?: string;
|
|
51
51
|
country?: string;
|
|
52
52
|
timeout?: number;
|
|
53
53
|
rendering_wait?: number;
|
|
54
54
|
wait_for_selector?: string;
|
|
55
|
-
options?: Options[];
|
|
55
|
+
options?: ('load_images' | 'dark_mode' | 'block_banners' | 'print_media_format' | Options)[];
|
|
56
56
|
auto_scroll?: boolean;
|
|
57
57
|
js?: string;
|
|
58
58
|
cache?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshotconfig.d.ts","sourceRoot":"","sources":["../src/screenshotconfig.ts"],"names":[],"mappings":"AAIA,oBAAY,OAAO;IACjB;;;;;;;QAOI;IACJ,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;CAC1C;AAED,oBAAY,MAAM;IAChB;;;;;;;QAOI;IACJ,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ;AAED,KAAK,uBAAuB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"screenshotconfig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AAM,CAAa;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,aAAa,GAAG,WAAW,GAAG,eAAe,GAAG,oBAAoB,GAAG,OAAO,CAAC,EAAE,CAAC;IAC7F,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEL,OAAO,EAAE,uBAAuB;IA8B5C,OAAO,CAAC,eAAe;IASvB,WAAW,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAqE3D"}
|
|
@@ -128,14 +128,13 @@ class ScreenshotConfig {
|
|
|
128
128
|
});
|
|
129
129
|
this.validateOptions(options);
|
|
130
130
|
if (options.format && !Object.values(Format).includes(options.format)) {
|
|
131
|
-
throw new errors_js_1.ScreenshotConfigError(`Invalid
|
|
131
|
+
throw new errors_js_1.ScreenshotConfigError(`Invalid Format param value: ${options.format}`);
|
|
132
132
|
}
|
|
133
133
|
this.format = options.format ?? this.format;
|
|
134
|
-
// Validate options against the enum
|
|
135
134
|
if (options.options) {
|
|
136
135
|
options.options.forEach((opt) => {
|
|
137
136
|
if (!Object.values(Options).includes(opt)) {
|
|
138
|
-
throw new errors_js_1.ScreenshotConfigError(`Invalid
|
|
137
|
+
throw new errors_js_1.ScreenshotConfigError(`Invalid Options param value: ${opt}`);
|
|
139
138
|
}
|
|
140
139
|
});
|
|
141
140
|
}
|