firecrawl 1.9.1 → 1.9.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/index.cjs +15 -1
- package/dist/index.js +15 -1
- package/package.json +1 -1
- package/src/index.ts +18 -1
package/dist/index.cjs
CHANGED
|
@@ -297,7 +297,21 @@ var FirecrawlApp = class {
|
|
|
297
297
|
*/
|
|
298
298
|
async batchScrapeUrls(urls, params, pollInterval = 2, idempotencyKey, webhook) {
|
|
299
299
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
300
|
-
let jsonData = { urls, ...params
|
|
300
|
+
let jsonData = { urls, ...params };
|
|
301
|
+
if (jsonData?.extract?.schema) {
|
|
302
|
+
let schema = jsonData.extract.schema;
|
|
303
|
+
try {
|
|
304
|
+
schema = (0, import_zod_to_json_schema.zodToJsonSchema)(schema);
|
|
305
|
+
} catch (error) {
|
|
306
|
+
}
|
|
307
|
+
jsonData = {
|
|
308
|
+
...jsonData,
|
|
309
|
+
extract: {
|
|
310
|
+
...jsonData.extract,
|
|
311
|
+
schema
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
}
|
|
301
315
|
try {
|
|
302
316
|
const response = await this.postRequest(
|
|
303
317
|
this.apiUrl + `/v1/batch/scrape`,
|
package/dist/index.js
CHANGED
|
@@ -261,7 +261,21 @@ var FirecrawlApp = class {
|
|
|
261
261
|
*/
|
|
262
262
|
async batchScrapeUrls(urls, params, pollInterval = 2, idempotencyKey, webhook) {
|
|
263
263
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
264
|
-
let jsonData = { urls, ...params
|
|
264
|
+
let jsonData = { urls, ...params };
|
|
265
|
+
if (jsonData?.extract?.schema) {
|
|
266
|
+
let schema = jsonData.extract.schema;
|
|
267
|
+
try {
|
|
268
|
+
schema = zodToJsonSchema(schema);
|
|
269
|
+
} catch (error) {
|
|
270
|
+
}
|
|
271
|
+
jsonData = {
|
|
272
|
+
...jsonData,
|
|
273
|
+
extract: {
|
|
274
|
+
...jsonData.extract,
|
|
275
|
+
schema
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
}
|
|
265
279
|
try {
|
|
266
280
|
const response = await this.postRequest(
|
|
267
281
|
this.apiUrl + `/v1/batch/scrape`,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -577,7 +577,24 @@ export default class FirecrawlApp {
|
|
|
577
577
|
webhook?: CrawlParams["webhook"],
|
|
578
578
|
): Promise<BatchScrapeStatusResponse | ErrorResponse> {
|
|
579
579
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
580
|
-
let jsonData: any = { urls, ...
|
|
580
|
+
let jsonData: any = { urls, ...params };
|
|
581
|
+
if (jsonData?.extract?.schema) {
|
|
582
|
+
let schema = jsonData.extract.schema;
|
|
583
|
+
|
|
584
|
+
// Try parsing the schema as a Zod schema
|
|
585
|
+
try {
|
|
586
|
+
schema = zodToJsonSchema(schema);
|
|
587
|
+
} catch (error) {
|
|
588
|
+
|
|
589
|
+
}
|
|
590
|
+
jsonData = {
|
|
591
|
+
...jsonData,
|
|
592
|
+
extract: {
|
|
593
|
+
...jsonData.extract,
|
|
594
|
+
schema: schema,
|
|
595
|
+
},
|
|
596
|
+
};
|
|
597
|
+
}
|
|
581
598
|
try {
|
|
582
599
|
const response: AxiosResponse = await this.postRequest(
|
|
583
600
|
this.apiUrl + `/v1/batch/scrape`,
|