firecrawl 1.15.3 → 1.16.0

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 CHANGED
@@ -276,7 +276,7 @@ var FirecrawlApp = class {
276
276
  targetURL.searchParams.set("skip", skip.toString());
277
277
  }
278
278
  if (limit !== void 0) {
279
- targetURL.searchParams.set("skip", limit.toString());
279
+ targetURL.searchParams.set("limit", limit.toString());
280
280
  }
281
281
  try {
282
282
  const response = await this.getRequest(
@@ -530,7 +530,7 @@ var FirecrawlApp = class {
530
530
  targetURL.searchParams.set("skip", skip.toString());
531
531
  }
532
532
  if (limit !== void 0) {
533
- targetURL.searchParams.set("skip", limit.toString());
533
+ targetURL.searchParams.set("limit", limit.toString());
534
534
  }
535
535
  try {
536
536
  const response = await this.getRequest(
@@ -629,7 +629,7 @@ var FirecrawlApp = class {
629
629
  try {
630
630
  const response = await this.postRequest(
631
631
  this.apiUrl + `/v1/extract`,
632
- { ...jsonData, schema: jsonSchema, origin: "api-sdk" },
632
+ { ...jsonData, schema: jsonSchema, origin: params?.origin || "api-sdk" },
633
633
  headers
634
634
  );
635
635
  if (response.status === 200) {
@@ -841,7 +841,7 @@ var FirecrawlApp = class {
841
841
  throw new FirecrawlError(
842
842
  `Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}${details}`,
843
843
  response.status,
844
- response.data.details
844
+ response?.data?.details
845
845
  );
846
846
  } else {
847
847
  throw new FirecrawlError(
@@ -859,7 +859,8 @@ var CrawlWatcher = class extends import_typescript_event_target.TypedEventTarget
859
859
  constructor(id, app) {
860
860
  super();
861
861
  this.id = id;
862
- this.ws = new import_isows.WebSocket(`${app.apiUrl}/v1/crawl/${id}`, app.apiKey);
862
+ const wsUrl = app.apiUrl.replace(/^http/, "ws");
863
+ this.ws = new import_isows.WebSocket(`${wsUrl}/v1/crawl/${id}`, app.apiKey);
863
864
  this.status = "scraping";
864
865
  this.data = [];
865
866
  const messageHandler = (msg) => {
package/dist/index.d.cts CHANGED
@@ -87,6 +87,7 @@ interface CrawlScrapeOptions {
87
87
  mobile?: boolean;
88
88
  skipTlsVerification?: boolean;
89
89
  removeBase64Images?: boolean;
90
+ blockAds?: boolean;
90
91
  }
91
92
  type Action = {
92
93
  type: "wait";
@@ -156,6 +157,7 @@ interface CrawlParams {
156
157
  url: string;
157
158
  headers?: Record<string, string>;
158
159
  metadata?: Record<string, string>;
160
+ events?: ["completed", "failed", "page", "started"][number][];
159
161
  };
160
162
  deduplicateSimilarURLs?: boolean;
161
163
  ignoreQueryParameters?: boolean;
@@ -219,6 +221,7 @@ interface MapParams {
219
221
  includeSubdomains?: boolean;
220
222
  sitemapOnly?: boolean;
221
223
  limit?: number;
224
+ timeout?: number;
222
225
  }
223
226
  /**
224
227
  * Response interface for mapping operations.
@@ -238,7 +241,9 @@ interface ExtractParams<LLMSchema extends zt.ZodSchema = any> {
238
241
  schema?: LLMSchema | object;
239
242
  systemPrompt?: string;
240
243
  allowExternalLinks?: boolean;
244
+ enableWebSearch?: boolean;
241
245
  includeSubdomains?: boolean;
246
+ origin?: string;
242
247
  }
243
248
  /**
244
249
  * Response interface for extracting information from URLs.
package/dist/index.d.ts CHANGED
@@ -87,6 +87,7 @@ interface CrawlScrapeOptions {
87
87
  mobile?: boolean;
88
88
  skipTlsVerification?: boolean;
89
89
  removeBase64Images?: boolean;
90
+ blockAds?: boolean;
90
91
  }
91
92
  type Action = {
92
93
  type: "wait";
@@ -156,6 +157,7 @@ interface CrawlParams {
156
157
  url: string;
157
158
  headers?: Record<string, string>;
158
159
  metadata?: Record<string, string>;
160
+ events?: ["completed", "failed", "page", "started"][number][];
159
161
  };
160
162
  deduplicateSimilarURLs?: boolean;
161
163
  ignoreQueryParameters?: boolean;
@@ -219,6 +221,7 @@ interface MapParams {
219
221
  includeSubdomains?: boolean;
220
222
  sitemapOnly?: boolean;
221
223
  limit?: number;
224
+ timeout?: number;
222
225
  }
223
226
  /**
224
227
  * Response interface for mapping operations.
@@ -238,7 +241,9 @@ interface ExtractParams<LLMSchema extends zt.ZodSchema = any> {
238
241
  schema?: LLMSchema | object;
239
242
  systemPrompt?: string;
240
243
  allowExternalLinks?: boolean;
244
+ enableWebSearch?: boolean;
241
245
  includeSubdomains?: boolean;
246
+ origin?: string;
242
247
  }
243
248
  /**
244
249
  * Response interface for extracting information from URLs.
package/dist/index.js CHANGED
@@ -240,7 +240,7 @@ var FirecrawlApp = class {
240
240
  targetURL.searchParams.set("skip", skip.toString());
241
241
  }
242
242
  if (limit !== void 0) {
243
- targetURL.searchParams.set("skip", limit.toString());
243
+ targetURL.searchParams.set("limit", limit.toString());
244
244
  }
245
245
  try {
246
246
  const response = await this.getRequest(
@@ -494,7 +494,7 @@ var FirecrawlApp = class {
494
494
  targetURL.searchParams.set("skip", skip.toString());
495
495
  }
496
496
  if (limit !== void 0) {
497
- targetURL.searchParams.set("skip", limit.toString());
497
+ targetURL.searchParams.set("limit", limit.toString());
498
498
  }
499
499
  try {
500
500
  const response = await this.getRequest(
@@ -593,7 +593,7 @@ var FirecrawlApp = class {
593
593
  try {
594
594
  const response = await this.postRequest(
595
595
  this.apiUrl + `/v1/extract`,
596
- { ...jsonData, schema: jsonSchema, origin: "api-sdk" },
596
+ { ...jsonData, schema: jsonSchema, origin: params?.origin || "api-sdk" },
597
597
  headers
598
598
  );
599
599
  if (response.status === 200) {
@@ -805,7 +805,7 @@ var FirecrawlApp = class {
805
805
  throw new FirecrawlError(
806
806
  `Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}${details}`,
807
807
  response.status,
808
- response.data.details
808
+ response?.data?.details
809
809
  );
810
810
  } else {
811
811
  throw new FirecrawlError(
@@ -823,7 +823,8 @@ var CrawlWatcher = class extends TypedEventTarget {
823
823
  constructor(id, app) {
824
824
  super();
825
825
  this.id = id;
826
- this.ws = new WebSocket(`${app.apiUrl}/v1/crawl/${id}`, app.apiKey);
826
+ const wsUrl = app.apiUrl.replace(/^http/, "ws");
827
+ this.ws = new WebSocket(`${wsUrl}/v1/crawl/${id}`, app.apiKey);
827
828
  this.status = "scraping";
828
829
  this.data = [];
829
830
  const messageHandler = (msg) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firecrawl",
3
- "version": "1.15.3",
3
+ "version": "1.16.0",
4
4
  "description": "JavaScript SDK for Firecrawl API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -93,6 +93,7 @@ export interface CrawlScrapeOptions {
93
93
  mobile?: boolean;
94
94
  skipTlsVerification?: boolean;
95
95
  removeBase64Images?: boolean;
96
+ blockAds?: boolean;
96
97
  }
97
98
 
98
99
  export type Action = {
@@ -167,6 +168,7 @@ export interface CrawlParams {
167
168
  url: string;
168
169
  headers?: Record<string, string>;
169
170
  metadata?: Record<string, string>;
171
+ events?: ["completed", "failed", "page", "started"][number][];
170
172
  };
171
173
  deduplicateSimilarURLs?: boolean;
172
174
  ignoreQueryParameters?: boolean;
@@ -235,6 +237,7 @@ export interface MapParams {
235
237
  includeSubdomains?: boolean;
236
238
  sitemapOnly?: boolean;
237
239
  limit?: number;
240
+ timeout?: number;
238
241
  }
239
242
 
240
243
  /**
@@ -256,7 +259,9 @@ export interface ExtractParams<LLMSchema extends zt.ZodSchema = any> {
256
259
  schema?: LLMSchema | object;
257
260
  systemPrompt?: string;
258
261
  allowExternalLinks?: boolean;
262
+ enableWebSearch?: boolean;
259
263
  includeSubdomains?: boolean;
264
+ origin?: string;
260
265
  }
261
266
 
262
267
  /**
@@ -606,7 +611,7 @@ export default class FirecrawlApp {
606
611
  targetURL.searchParams.set("skip", skip.toString());
607
612
  }
608
613
  if (limit !== undefined) {
609
- targetURL.searchParams.set("skip", limit.toString());
614
+ targetURL.searchParams.set("limit", limit.toString());
610
615
  }
611
616
 
612
617
  try {
@@ -908,7 +913,7 @@ export default class FirecrawlApp {
908
913
  targetURL.searchParams.set("skip", skip.toString());
909
914
  }
910
915
  if (limit !== undefined) {
911
- targetURL.searchParams.set("skip", limit.toString());
916
+ targetURL.searchParams.set("limit", limit.toString());
912
917
  }
913
918
 
914
919
  try {
@@ -1013,10 +1018,11 @@ export default class FirecrawlApp {
1013
1018
  throw new FirecrawlError("Invalid schema. Schema must be either a valid Zod schema or JSON schema object.", 400);
1014
1019
  }
1015
1020
 
1021
+
1016
1022
  try {
1017
1023
  const response: AxiosResponse = await this.postRequest(
1018
1024
  this.apiUrl + `/v1/extract`,
1019
- { ...jsonData, schema: jsonSchema, origin: "api-sdk" },
1025
+ { ...jsonData, schema: jsonSchema, origin: params?.origin || "api-sdk" },
1020
1026
  headers
1021
1027
  );
1022
1028
 
@@ -1262,7 +1268,7 @@ export default class FirecrawlApp {
1262
1268
  throw new FirecrawlError(
1263
1269
  `Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}${details}`,
1264
1270
  response.status,
1265
- response.data.details
1271
+ response?.data?.details
1266
1272
  );
1267
1273
  } else {
1268
1274
  throw new FirecrawlError(
@@ -1295,7 +1301,9 @@ export class CrawlWatcher extends TypedEventTarget<CrawlWatcherEvents> {
1295
1301
  constructor(id: string, app: FirecrawlApp) {
1296
1302
  super();
1297
1303
  this.id = id;
1298
- this.ws = new WebSocket(`${app.apiUrl}/v1/crawl/${id}`, app.apiKey);
1304
+ // replace `http` with `ws` (`http://` -> `ws://` and `https://` -> `wss://`)
1305
+ const wsUrl = app.apiUrl.replace(/^http/, "ws");
1306
+ this.ws = new WebSocket(`${wsUrl}/v1/crawl/${id}`, app.apiKey);
1299
1307
  this.status = "scraping";
1300
1308
  this.data = [];
1301
1309