firecrawl 4.22.1 → 4.23.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/README.md +13 -1
- package/dist/{chunk-WTZQ5IMF.js → chunk-ZR3KTUEQ.js} +1 -1
- package/dist/index.cjs +13 -1
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +14 -2
- package/dist/{package-YDTOLYXI.js → package-APBHZ5F3.js} +1 -1
- package/package.json +1 -1
- package/src/__tests__/unit/v2/parse.unit.test.ts +18 -0
- package/src/__tests__/unit/v2/validation.test.ts +5 -0
- package/src/v1/index.ts +16 -0
- package/src/v2/client.ts +1 -0
- package/src/v2/types.ts +6 -2
- package/src/v2/utils/validation.ts +6 -0
package/README.md
CHANGED
|
@@ -46,10 +46,22 @@ const url = 'https://example.com';
|
|
|
46
46
|
const scrapedData = await app.scrape(url);
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
### Video extraction
|
|
50
|
+
|
|
51
|
+
Use the `video` format on supported video URLs, including YouTube and TikTok. The returned `video` field is a signed URL to the extracted video file.
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
const doc = await app.scrape('https://www.youtube.com/watch?v=dQw4w9WgXcQ', {
|
|
55
|
+
formats: ['video'],
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
console.log(doc.video);
|
|
59
|
+
```
|
|
60
|
+
|
|
49
61
|
### Parsing uploaded files
|
|
50
62
|
|
|
51
63
|
Use `parse` to upload a file (`html`, `pdf`, `docx`, etc.) as multipart form data and process it through the same parsing pipeline.
|
|
52
|
-
Parse does not support browser-only formats/options like `changeTracking`, `screenshot`, `branding`, `actions`, `waitFor`, `location`, or `mobile`.
|
|
64
|
+
Parse does not support browser-only formats/options like `changeTracking`, `screenshot`, `branding`, `audio`, `video`, `actions`, `waitFor`, `location`, or `mobile`.
|
|
53
65
|
|
|
54
66
|
```js
|
|
55
67
|
const parsed = await app.parse(
|
|
@@ -8,7 +8,7 @@ var require_package = __commonJS({
|
|
|
8
8
|
"package.json"(exports, module) {
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: "@mendable/firecrawl-js",
|
|
11
|
-
version: "4.
|
|
11
|
+
version: "4.23.0",
|
|
12
12
|
description: "JavaScript SDK for Firecrawl API",
|
|
13
13
|
main: "dist/index.js",
|
|
14
14
|
types: "dist/index.d.ts",
|
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ var require_package = __commonJS({
|
|
|
35
35
|
"package.json"(exports2, module2) {
|
|
36
36
|
module2.exports = {
|
|
37
37
|
name: "@mendable/firecrawl-js",
|
|
38
|
-
version: "4.
|
|
38
|
+
version: "4.23.0",
|
|
39
39
|
description: "JavaScript SDK for Firecrawl API",
|
|
40
40
|
main: "dist/index.js",
|
|
41
41
|
types: "dist/index.d.ts",
|
|
@@ -426,6 +426,9 @@ function ensureValidParseFormats(formats) {
|
|
|
426
426
|
if (fmt === "branding") {
|
|
427
427
|
throw new Error("parse does not support branding format");
|
|
428
428
|
}
|
|
429
|
+
if (fmt === "audio" || fmt === "video") {
|
|
430
|
+
throw new Error(`parse does not support ${fmt} format`);
|
|
431
|
+
}
|
|
429
432
|
continue;
|
|
430
433
|
}
|
|
431
434
|
const type = fmt.type;
|
|
@@ -438,6 +441,9 @@ function ensureValidParseFormats(formats) {
|
|
|
438
441
|
if (type === "branding") {
|
|
439
442
|
throw new Error("parse does not support branding format");
|
|
440
443
|
}
|
|
444
|
+
if (type === "audio" || type === "video") {
|
|
445
|
+
throw new Error(`parse does not support ${type} format`);
|
|
446
|
+
}
|
|
441
447
|
if (fmt.type === "json") {
|
|
442
448
|
const j = fmt;
|
|
443
449
|
if (!j.prompt && !j.schema) {
|
|
@@ -2986,6 +2992,7 @@ var FirecrawlApp = class {
|
|
|
2986
2992
|
* @param onActivity - Optional callback to receive activity updates in real-time.
|
|
2987
2993
|
* @param onSource - Optional callback to receive source updates in real-time.
|
|
2988
2994
|
* @returns The final research results.
|
|
2995
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
2989
2996
|
*/
|
|
2990
2997
|
async deepResearch(query, params, onActivity, onSource) {
|
|
2991
2998
|
try {
|
|
@@ -3042,6 +3049,7 @@ var FirecrawlApp = class {
|
|
|
3042
3049
|
* Initiates a deep research operation on a given query without polling.
|
|
3043
3050
|
* @param params - Parameters for the deep research operation.
|
|
3044
3051
|
* @returns The response containing the research job ID.
|
|
3052
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
3045
3053
|
*/
|
|
3046
3054
|
async asyncDeepResearch(query, params) {
|
|
3047
3055
|
const headers = this.prepareHeaders();
|
|
@@ -3079,6 +3087,7 @@ var FirecrawlApp = class {
|
|
|
3079
3087
|
* Checks the status of a deep research operation.
|
|
3080
3088
|
* @param id - The ID of the deep research operation.
|
|
3081
3089
|
* @returns The current status and results of the research operation.
|
|
3090
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
3082
3091
|
*/
|
|
3083
3092
|
async checkDeepResearchStatus(id) {
|
|
3084
3093
|
const headers = this.prepareHeaders();
|
|
@@ -3217,6 +3226,7 @@ var FirecrawlApp = class {
|
|
|
3217
3226
|
* @param url - The URL to generate LLMs.txt from.
|
|
3218
3227
|
* @param params - Parameters for the LLMs.txt generation operation.
|
|
3219
3228
|
* @returns The final generation results.
|
|
3229
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
3220
3230
|
*/
|
|
3221
3231
|
async generateLLMsText(url, params) {
|
|
3222
3232
|
try {
|
|
@@ -3258,6 +3268,7 @@ var FirecrawlApp = class {
|
|
|
3258
3268
|
* @param url - The URL to generate LLMs.txt from.
|
|
3259
3269
|
* @param params - Parameters for the LLMs.txt generation operation.
|
|
3260
3270
|
* @returns The response containing the generation job ID.
|
|
3271
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
3261
3272
|
*/
|
|
3262
3273
|
async asyncGenerateLLMsText(url, params) {
|
|
3263
3274
|
const headers = this.prepareHeaders();
|
|
@@ -3286,6 +3297,7 @@ var FirecrawlApp = class {
|
|
|
3286
3297
|
* Checks the status of a LLMs.txt generation operation.
|
|
3287
3298
|
* @param id - The ID of the LLMs.txt generation operation.
|
|
3288
3299
|
* @returns The current status and results of the generation operation.
|
|
3300
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
3289
3301
|
*/
|
|
3290
3302
|
async checkGenerateLLMsTextStatus(id) {
|
|
3291
3303
|
const headers = this.prepareHeaders();
|
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import { AxiosResponse, AxiosRequestHeaders } from 'axios';
|
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import { TypedEventTarget } from 'typescript-event-target';
|
|
6
6
|
|
|
7
|
-
type FormatString = 'markdown' | 'html' | 'rawHtml' | 'links' | 'images' | 'screenshot' | 'summary' | 'changeTracking' | 'json' | 'attributes' | 'branding' | 'audio';
|
|
7
|
+
type FormatString = 'markdown' | 'html' | 'rawHtml' | 'links' | 'images' | 'screenshot' | 'summary' | 'changeTracking' | 'json' | 'attributes' | 'branding' | 'audio' | 'video';
|
|
8
8
|
interface Viewport {
|
|
9
9
|
width: number;
|
|
10
10
|
height: number;
|
|
@@ -55,7 +55,7 @@ interface QueryFormat {
|
|
|
55
55
|
mode?: 'freeform' | 'directQuote';
|
|
56
56
|
}
|
|
57
57
|
type FormatOption = FormatString | Format | JsonFormat | ChangeTrackingFormat | ScreenshotFormat | AttributesFormat | QuestionFormat | HighlightsFormat | QueryFormat;
|
|
58
|
-
type ParseFormatString = Exclude<FormatString, 'screenshot' | 'changeTracking' | 'branding'>;
|
|
58
|
+
type ParseFormatString = Exclude<FormatString, 'screenshot' | 'changeTracking' | 'branding' | 'audio' | 'video'>;
|
|
59
59
|
interface ParseFormat {
|
|
60
60
|
type: ParseFormatString;
|
|
61
61
|
}
|
|
@@ -347,6 +347,7 @@ interface Document {
|
|
|
347
347
|
images?: string[];
|
|
348
348
|
screenshot?: string;
|
|
349
349
|
audio?: string;
|
|
350
|
+
video?: string;
|
|
350
351
|
attributes?: Array<{
|
|
351
352
|
selector: string;
|
|
352
353
|
attribute: string;
|
|
@@ -621,6 +622,8 @@ interface ExtractResponse$1 {
|
|
|
621
622
|
data?: unknown;
|
|
622
623
|
error?: string;
|
|
623
624
|
warning?: string;
|
|
625
|
+
warnings?: string[];
|
|
626
|
+
replacement?: string;
|
|
624
627
|
sources?: Record<string, unknown>;
|
|
625
628
|
expiresAt?: string;
|
|
626
629
|
creditsUsed?: number;
|
|
@@ -956,6 +959,7 @@ declare class FirecrawlClient {
|
|
|
956
959
|
* @param file File payload (data, filename, optional contentType).
|
|
957
960
|
* @param options Optional parse options (formats, parsers, etc.).
|
|
958
961
|
* Note: parse does not support changeTracking, screenshot, branding,
|
|
962
|
+
* audio, video,
|
|
959
963
|
* actions, waitFor, location, or mobile options.
|
|
960
964
|
* @returns Parsed document with requested formats.
|
|
961
965
|
*/
|
|
@@ -1521,6 +1525,8 @@ interface ExtractResponse<LLMSchema extends zt.ZodSchema = any> {
|
|
|
1521
1525
|
data: LLMSchema;
|
|
1522
1526
|
error?: string;
|
|
1523
1527
|
warning?: string;
|
|
1528
|
+
warnings?: string[];
|
|
1529
|
+
replacement?: string;
|
|
1524
1530
|
sources?: string[];
|
|
1525
1531
|
creditsUsed?: number;
|
|
1526
1532
|
}
|
|
@@ -1623,6 +1629,8 @@ interface DeepResearchParams<LLMSchema extends zt.ZodSchema = any> {
|
|
|
1623
1629
|
interface DeepResearchResponse {
|
|
1624
1630
|
success: boolean;
|
|
1625
1631
|
id: string;
|
|
1632
|
+
warnings?: string[];
|
|
1633
|
+
replacement?: string;
|
|
1626
1634
|
}
|
|
1627
1635
|
/**
|
|
1628
1636
|
* Status response interface for deep research operations.
|
|
@@ -1662,6 +1670,8 @@ interface DeepResearchStatusResponse {
|
|
|
1662
1670
|
description: string;
|
|
1663
1671
|
}>;
|
|
1664
1672
|
summaries: string[];
|
|
1673
|
+
warnings?: string[];
|
|
1674
|
+
replacement?: string;
|
|
1665
1675
|
}
|
|
1666
1676
|
/**
|
|
1667
1677
|
* Parameters for LLMs.txt generation operations.
|
|
@@ -1693,6 +1703,8 @@ interface GenerateLLMsTextParams {
|
|
|
1693
1703
|
interface GenerateLLMsTextResponse {
|
|
1694
1704
|
success: boolean;
|
|
1695
1705
|
id: string;
|
|
1706
|
+
warnings?: string[];
|
|
1707
|
+
replacement?: string;
|
|
1696
1708
|
}
|
|
1697
1709
|
/**
|
|
1698
1710
|
* Status response interface for LLMs.txt generation operations.
|
|
@@ -1706,6 +1718,8 @@ interface GenerateLLMsTextStatusResponse {
|
|
|
1706
1718
|
status: "processing" | "completed" | "failed";
|
|
1707
1719
|
error?: string;
|
|
1708
1720
|
expiresAt: string;
|
|
1721
|
+
warnings?: string[];
|
|
1722
|
+
replacement?: string;
|
|
1709
1723
|
}
|
|
1710
1724
|
/**
|
|
1711
1725
|
* Response interface for queue status operations.
|
|
@@ -1955,6 +1969,7 @@ declare class FirecrawlApp {
|
|
|
1955
1969
|
* @param onActivity - Optional callback to receive activity updates in real-time.
|
|
1956
1970
|
* @param onSource - Optional callback to receive source updates in real-time.
|
|
1957
1971
|
* @returns The final research results.
|
|
1972
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
1958
1973
|
*/
|
|
1959
1974
|
deepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>, onActivity?: (activity: {
|
|
1960
1975
|
type: string;
|
|
@@ -1972,12 +1987,14 @@ declare class FirecrawlApp {
|
|
|
1972
1987
|
* Initiates a deep research operation on a given query without polling.
|
|
1973
1988
|
* @param params - Parameters for the deep research operation.
|
|
1974
1989
|
* @returns The response containing the research job ID.
|
|
1990
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
1975
1991
|
*/
|
|
1976
1992
|
asyncDeepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>): Promise<DeepResearchResponse | ErrorResponse>;
|
|
1977
1993
|
/**
|
|
1978
1994
|
* Checks the status of a deep research operation.
|
|
1979
1995
|
* @param id - The ID of the deep research operation.
|
|
1980
1996
|
* @returns The current status and results of the research operation.
|
|
1997
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
1981
1998
|
*/
|
|
1982
1999
|
checkDeepResearchStatus(id: string): Promise<DeepResearchStatusResponse | ErrorResponse>;
|
|
1983
2000
|
/**
|
|
@@ -2014,6 +2031,7 @@ declare class FirecrawlApp {
|
|
|
2014
2031
|
* @param url - The URL to generate LLMs.txt from.
|
|
2015
2032
|
* @param params - Parameters for the LLMs.txt generation operation.
|
|
2016
2033
|
* @returns The final generation results.
|
|
2034
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
2017
2035
|
*/
|
|
2018
2036
|
generateLLMsText(url: string, params?: GenerateLLMsTextParams): Promise<GenerateLLMsTextStatusResponse | ErrorResponse>;
|
|
2019
2037
|
/**
|
|
@@ -2021,12 +2039,14 @@ declare class FirecrawlApp {
|
|
|
2021
2039
|
* @param url - The URL to generate LLMs.txt from.
|
|
2022
2040
|
* @param params - Parameters for the LLMs.txt generation operation.
|
|
2023
2041
|
* @returns The response containing the generation job ID.
|
|
2042
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
2024
2043
|
*/
|
|
2025
2044
|
asyncGenerateLLMsText(url: string, params?: GenerateLLMsTextParams): Promise<GenerateLLMsTextResponse | ErrorResponse>;
|
|
2026
2045
|
/**
|
|
2027
2046
|
* Checks the status of a LLMs.txt generation operation.
|
|
2028
2047
|
* @param id - The ID of the LLMs.txt generation operation.
|
|
2029
2048
|
* @returns The current status and results of the generation operation.
|
|
2049
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
2030
2050
|
*/
|
|
2031
2051
|
checkGenerateLLMsTextStatus(id: string): Promise<GenerateLLMsTextStatusResponse | ErrorResponse>;
|
|
2032
2052
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { AxiosResponse, AxiosRequestHeaders } from 'axios';
|
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import { TypedEventTarget } from 'typescript-event-target';
|
|
6
6
|
|
|
7
|
-
type FormatString = 'markdown' | 'html' | 'rawHtml' | 'links' | 'images' | 'screenshot' | 'summary' | 'changeTracking' | 'json' | 'attributes' | 'branding' | 'audio';
|
|
7
|
+
type FormatString = 'markdown' | 'html' | 'rawHtml' | 'links' | 'images' | 'screenshot' | 'summary' | 'changeTracking' | 'json' | 'attributes' | 'branding' | 'audio' | 'video';
|
|
8
8
|
interface Viewport {
|
|
9
9
|
width: number;
|
|
10
10
|
height: number;
|
|
@@ -55,7 +55,7 @@ interface QueryFormat {
|
|
|
55
55
|
mode?: 'freeform' | 'directQuote';
|
|
56
56
|
}
|
|
57
57
|
type FormatOption = FormatString | Format | JsonFormat | ChangeTrackingFormat | ScreenshotFormat | AttributesFormat | QuestionFormat | HighlightsFormat | QueryFormat;
|
|
58
|
-
type ParseFormatString = Exclude<FormatString, 'screenshot' | 'changeTracking' | 'branding'>;
|
|
58
|
+
type ParseFormatString = Exclude<FormatString, 'screenshot' | 'changeTracking' | 'branding' | 'audio' | 'video'>;
|
|
59
59
|
interface ParseFormat {
|
|
60
60
|
type: ParseFormatString;
|
|
61
61
|
}
|
|
@@ -347,6 +347,7 @@ interface Document {
|
|
|
347
347
|
images?: string[];
|
|
348
348
|
screenshot?: string;
|
|
349
349
|
audio?: string;
|
|
350
|
+
video?: string;
|
|
350
351
|
attributes?: Array<{
|
|
351
352
|
selector: string;
|
|
352
353
|
attribute: string;
|
|
@@ -621,6 +622,8 @@ interface ExtractResponse$1 {
|
|
|
621
622
|
data?: unknown;
|
|
622
623
|
error?: string;
|
|
623
624
|
warning?: string;
|
|
625
|
+
warnings?: string[];
|
|
626
|
+
replacement?: string;
|
|
624
627
|
sources?: Record<string, unknown>;
|
|
625
628
|
expiresAt?: string;
|
|
626
629
|
creditsUsed?: number;
|
|
@@ -956,6 +959,7 @@ declare class FirecrawlClient {
|
|
|
956
959
|
* @param file File payload (data, filename, optional contentType).
|
|
957
960
|
* @param options Optional parse options (formats, parsers, etc.).
|
|
958
961
|
* Note: parse does not support changeTracking, screenshot, branding,
|
|
962
|
+
* audio, video,
|
|
959
963
|
* actions, waitFor, location, or mobile options.
|
|
960
964
|
* @returns Parsed document with requested formats.
|
|
961
965
|
*/
|
|
@@ -1521,6 +1525,8 @@ interface ExtractResponse<LLMSchema extends zt.ZodSchema = any> {
|
|
|
1521
1525
|
data: LLMSchema;
|
|
1522
1526
|
error?: string;
|
|
1523
1527
|
warning?: string;
|
|
1528
|
+
warnings?: string[];
|
|
1529
|
+
replacement?: string;
|
|
1524
1530
|
sources?: string[];
|
|
1525
1531
|
creditsUsed?: number;
|
|
1526
1532
|
}
|
|
@@ -1623,6 +1629,8 @@ interface DeepResearchParams<LLMSchema extends zt.ZodSchema = any> {
|
|
|
1623
1629
|
interface DeepResearchResponse {
|
|
1624
1630
|
success: boolean;
|
|
1625
1631
|
id: string;
|
|
1632
|
+
warnings?: string[];
|
|
1633
|
+
replacement?: string;
|
|
1626
1634
|
}
|
|
1627
1635
|
/**
|
|
1628
1636
|
* Status response interface for deep research operations.
|
|
@@ -1662,6 +1670,8 @@ interface DeepResearchStatusResponse {
|
|
|
1662
1670
|
description: string;
|
|
1663
1671
|
}>;
|
|
1664
1672
|
summaries: string[];
|
|
1673
|
+
warnings?: string[];
|
|
1674
|
+
replacement?: string;
|
|
1665
1675
|
}
|
|
1666
1676
|
/**
|
|
1667
1677
|
* Parameters for LLMs.txt generation operations.
|
|
@@ -1693,6 +1703,8 @@ interface GenerateLLMsTextParams {
|
|
|
1693
1703
|
interface GenerateLLMsTextResponse {
|
|
1694
1704
|
success: boolean;
|
|
1695
1705
|
id: string;
|
|
1706
|
+
warnings?: string[];
|
|
1707
|
+
replacement?: string;
|
|
1696
1708
|
}
|
|
1697
1709
|
/**
|
|
1698
1710
|
* Status response interface for LLMs.txt generation operations.
|
|
@@ -1706,6 +1718,8 @@ interface GenerateLLMsTextStatusResponse {
|
|
|
1706
1718
|
status: "processing" | "completed" | "failed";
|
|
1707
1719
|
error?: string;
|
|
1708
1720
|
expiresAt: string;
|
|
1721
|
+
warnings?: string[];
|
|
1722
|
+
replacement?: string;
|
|
1709
1723
|
}
|
|
1710
1724
|
/**
|
|
1711
1725
|
* Response interface for queue status operations.
|
|
@@ -1955,6 +1969,7 @@ declare class FirecrawlApp {
|
|
|
1955
1969
|
* @param onActivity - Optional callback to receive activity updates in real-time.
|
|
1956
1970
|
* @param onSource - Optional callback to receive source updates in real-time.
|
|
1957
1971
|
* @returns The final research results.
|
|
1972
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
1958
1973
|
*/
|
|
1959
1974
|
deepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>, onActivity?: (activity: {
|
|
1960
1975
|
type: string;
|
|
@@ -1972,12 +1987,14 @@ declare class FirecrawlApp {
|
|
|
1972
1987
|
* Initiates a deep research operation on a given query without polling.
|
|
1973
1988
|
* @param params - Parameters for the deep research operation.
|
|
1974
1989
|
* @returns The response containing the research job ID.
|
|
1990
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
1975
1991
|
*/
|
|
1976
1992
|
asyncDeepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>): Promise<DeepResearchResponse | ErrorResponse>;
|
|
1977
1993
|
/**
|
|
1978
1994
|
* Checks the status of a deep research operation.
|
|
1979
1995
|
* @param id - The ID of the deep research operation.
|
|
1980
1996
|
* @returns The current status and results of the research operation.
|
|
1997
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
1981
1998
|
*/
|
|
1982
1999
|
checkDeepResearchStatus(id: string): Promise<DeepResearchStatusResponse | ErrorResponse>;
|
|
1983
2000
|
/**
|
|
@@ -2014,6 +2031,7 @@ declare class FirecrawlApp {
|
|
|
2014
2031
|
* @param url - The URL to generate LLMs.txt from.
|
|
2015
2032
|
* @param params - Parameters for the LLMs.txt generation operation.
|
|
2016
2033
|
* @returns The final generation results.
|
|
2034
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
2017
2035
|
*/
|
|
2018
2036
|
generateLLMsText(url: string, params?: GenerateLLMsTextParams): Promise<GenerateLLMsTextStatusResponse | ErrorResponse>;
|
|
2019
2037
|
/**
|
|
@@ -2021,12 +2039,14 @@ declare class FirecrawlApp {
|
|
|
2021
2039
|
* @param url - The URL to generate LLMs.txt from.
|
|
2022
2040
|
* @param params - Parameters for the LLMs.txt generation operation.
|
|
2023
2041
|
* @returns The response containing the generation job ID.
|
|
2042
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
2024
2043
|
*/
|
|
2025
2044
|
asyncGenerateLLMsText(url: string, params?: GenerateLLMsTextParams): Promise<GenerateLLMsTextResponse | ErrorResponse>;
|
|
2026
2045
|
/**
|
|
2027
2046
|
* Checks the status of a LLMs.txt generation operation.
|
|
2028
2047
|
* @param id - The ID of the LLMs.txt generation operation.
|
|
2029
2048
|
* @returns The current status and results of the generation operation.
|
|
2049
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
2030
2050
|
*/
|
|
2031
2051
|
checkGenerateLLMsTextStatus(id: string): Promise<GenerateLLMsTextStatusResponse | ErrorResponse>;
|
|
2032
2052
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
require_package
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZR3KTUEQ.js";
|
|
4
4
|
|
|
5
5
|
// src/v2/utils/httpClient.ts
|
|
6
6
|
import axios from "axios";
|
|
@@ -302,6 +302,9 @@ function ensureValidParseFormats(formats) {
|
|
|
302
302
|
if (fmt === "branding") {
|
|
303
303
|
throw new Error("parse does not support branding format");
|
|
304
304
|
}
|
|
305
|
+
if (fmt === "audio" || fmt === "video") {
|
|
306
|
+
throw new Error(`parse does not support ${fmt} format`);
|
|
307
|
+
}
|
|
305
308
|
continue;
|
|
306
309
|
}
|
|
307
310
|
const type = fmt.type;
|
|
@@ -314,6 +317,9 @@ function ensureValidParseFormats(formats) {
|
|
|
314
317
|
if (type === "branding") {
|
|
315
318
|
throw new Error("parse does not support branding format");
|
|
316
319
|
}
|
|
320
|
+
if (type === "audio" || type === "video") {
|
|
321
|
+
throw new Error(`parse does not support ${type} format`);
|
|
322
|
+
}
|
|
317
323
|
if (fmt.type === "json") {
|
|
318
324
|
const j = fmt;
|
|
319
325
|
if (!j.prompt && !j.schema) {
|
|
@@ -2036,7 +2042,7 @@ var FirecrawlApp = class {
|
|
|
2036
2042
|
if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
|
|
2037
2043
|
return process.env.npm_package_version;
|
|
2038
2044
|
}
|
|
2039
|
-
const packageJson = await import("./package-
|
|
2045
|
+
const packageJson = await import("./package-APBHZ5F3.js");
|
|
2040
2046
|
return packageJson.default.version;
|
|
2041
2047
|
} catch (error) {
|
|
2042
2048
|
const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
|
|
@@ -2862,6 +2868,7 @@ var FirecrawlApp = class {
|
|
|
2862
2868
|
* @param onActivity - Optional callback to receive activity updates in real-time.
|
|
2863
2869
|
* @param onSource - Optional callback to receive source updates in real-time.
|
|
2864
2870
|
* @returns The final research results.
|
|
2871
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
2865
2872
|
*/
|
|
2866
2873
|
async deepResearch(query, params, onActivity, onSource) {
|
|
2867
2874
|
try {
|
|
@@ -2918,6 +2925,7 @@ var FirecrawlApp = class {
|
|
|
2918
2925
|
* Initiates a deep research operation on a given query without polling.
|
|
2919
2926
|
* @param params - Parameters for the deep research operation.
|
|
2920
2927
|
* @returns The response containing the research job ID.
|
|
2928
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
2921
2929
|
*/
|
|
2922
2930
|
async asyncDeepResearch(query, params) {
|
|
2923
2931
|
const headers = this.prepareHeaders();
|
|
@@ -2955,6 +2963,7 @@ var FirecrawlApp = class {
|
|
|
2955
2963
|
* Checks the status of a deep research operation.
|
|
2956
2964
|
* @param id - The ID of the deep research operation.
|
|
2957
2965
|
* @returns The current status and results of the research operation.
|
|
2966
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
2958
2967
|
*/
|
|
2959
2968
|
async checkDeepResearchStatus(id) {
|
|
2960
2969
|
const headers = this.prepareHeaders();
|
|
@@ -3093,6 +3102,7 @@ var FirecrawlApp = class {
|
|
|
3093
3102
|
* @param url - The URL to generate LLMs.txt from.
|
|
3094
3103
|
* @param params - Parameters for the LLMs.txt generation operation.
|
|
3095
3104
|
* @returns The final generation results.
|
|
3105
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
3096
3106
|
*/
|
|
3097
3107
|
async generateLLMsText(url, params) {
|
|
3098
3108
|
try {
|
|
@@ -3134,6 +3144,7 @@ var FirecrawlApp = class {
|
|
|
3134
3144
|
* @param url - The URL to generate LLMs.txt from.
|
|
3135
3145
|
* @param params - Parameters for the LLMs.txt generation operation.
|
|
3136
3146
|
* @returns The response containing the generation job ID.
|
|
3147
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
3137
3148
|
*/
|
|
3138
3149
|
async asyncGenerateLLMsText(url, params) {
|
|
3139
3150
|
const headers = this.prepareHeaders();
|
|
@@ -3162,6 +3173,7 @@ var FirecrawlApp = class {
|
|
|
3162
3173
|
* Checks the status of a LLMs.txt generation operation.
|
|
3163
3174
|
* @param id - The ID of the LLMs.txt generation operation.
|
|
3164
3175
|
* @returns The current status and results of the generation operation.
|
|
3176
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
3165
3177
|
*/
|
|
3166
3178
|
async checkGenerateLLMsTextStatus(id) {
|
|
3167
3179
|
const headers = this.prepareHeaders();
|
package/package.json
CHANGED
|
@@ -38,6 +38,24 @@ describe("v2.parse unit", () => {
|
|
|
38
38
|
).rejects.toThrow("parse does not support changeTracking format");
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
+
test("rejects video format before making requests", async () => {
|
|
42
|
+
const client = new FirecrawlClient({
|
|
43
|
+
apiKey: "test-key",
|
|
44
|
+
apiUrl: "https://localhost:3002",
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
await expect(
|
|
48
|
+
client.parse(
|
|
49
|
+
{
|
|
50
|
+
data: Buffer.from("<html></html>"),
|
|
51
|
+
filename: "upload.html",
|
|
52
|
+
contentType: "text/html",
|
|
53
|
+
},
|
|
54
|
+
{ formats: ["video" as any] },
|
|
55
|
+
),
|
|
56
|
+
).rejects.toThrow("parse does not support video format");
|
|
57
|
+
});
|
|
58
|
+
|
|
41
59
|
test("rejects lockdown option before making requests", async () => {
|
|
42
60
|
const client = new FirecrawlClient({
|
|
43
61
|
apiKey: "test-key",
|
|
@@ -9,6 +9,11 @@ describe("v2 utils: validation", () => {
|
|
|
9
9
|
expect(() => ensureValidFormats(formats)).toThrow(/json format must be an object/i);
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
+
test("ensureValidFormats: accepts video string format", () => {
|
|
13
|
+
const formats: FormatOption[] = ["markdown", "video"];
|
|
14
|
+
expect(() => ensureValidFormats(formats)).not.toThrow();
|
|
15
|
+
});
|
|
16
|
+
|
|
12
17
|
test("ensureValidFormats: json format requires prompt or schema", () => {
|
|
13
18
|
// Valid cases - should not throw
|
|
14
19
|
const valid1: FormatOption[] = [{ type: "json", prompt: "p" } as any];
|
package/src/v1/index.ts
CHANGED
|
@@ -363,6 +363,8 @@ export interface ExtractResponse<LLMSchema extends zt.ZodSchema = any> {
|
|
|
363
363
|
data: LLMSchema;
|
|
364
364
|
error?: string;
|
|
365
365
|
warning?: string;
|
|
366
|
+
warnings?: string[];
|
|
367
|
+
replacement?: string;
|
|
366
368
|
sources?: string[];
|
|
367
369
|
creditsUsed?: number;
|
|
368
370
|
}
|
|
@@ -490,6 +492,8 @@ export interface DeepResearchParams<LLMSchema extends zt.ZodSchema = any> {
|
|
|
490
492
|
export interface DeepResearchResponse {
|
|
491
493
|
success: boolean;
|
|
492
494
|
id: string;
|
|
495
|
+
warnings?: string[];
|
|
496
|
+
replacement?: string;
|
|
493
497
|
}
|
|
494
498
|
|
|
495
499
|
/**
|
|
@@ -530,6 +534,8 @@ export interface DeepResearchStatusResponse {
|
|
|
530
534
|
description: string;
|
|
531
535
|
}>;
|
|
532
536
|
summaries: string[];
|
|
537
|
+
warnings?: string[];
|
|
538
|
+
replacement?: string;
|
|
533
539
|
}
|
|
534
540
|
|
|
535
541
|
/**
|
|
@@ -563,6 +569,8 @@ export interface GenerateLLMsTextParams {
|
|
|
563
569
|
export interface GenerateLLMsTextResponse {
|
|
564
570
|
success: boolean;
|
|
565
571
|
id: string;
|
|
572
|
+
warnings?: string[];
|
|
573
|
+
replacement?: string;
|
|
566
574
|
}
|
|
567
575
|
|
|
568
576
|
/**
|
|
@@ -577,6 +585,8 @@ export interface GenerateLLMsTextStatusResponse {
|
|
|
577
585
|
status: "processing" | "completed" | "failed";
|
|
578
586
|
error?: string;
|
|
579
587
|
expiresAt: string;
|
|
588
|
+
warnings?: string[];
|
|
589
|
+
replacement?: string;
|
|
580
590
|
}
|
|
581
591
|
|
|
582
592
|
/**
|
|
@@ -1626,6 +1636,7 @@ export default class FirecrawlApp {
|
|
|
1626
1636
|
* @param onActivity - Optional callback to receive activity updates in real-time.
|
|
1627
1637
|
* @param onSource - Optional callback to receive source updates in real-time.
|
|
1628
1638
|
* @returns The final research results.
|
|
1639
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
1629
1640
|
*/
|
|
1630
1641
|
async deepResearch(
|
|
1631
1642
|
query: string,
|
|
@@ -1713,6 +1724,7 @@ export default class FirecrawlApp {
|
|
|
1713
1724
|
* Initiates a deep research operation on a given query without polling.
|
|
1714
1725
|
* @param params - Parameters for the deep research operation.
|
|
1715
1726
|
* @returns The response containing the research job ID.
|
|
1727
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
1716
1728
|
*/
|
|
1717
1729
|
async asyncDeepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>): Promise<DeepResearchResponse | ErrorResponse> {
|
|
1718
1730
|
const headers = this.prepareHeaders();
|
|
@@ -1754,6 +1766,7 @@ export default class FirecrawlApp {
|
|
|
1754
1766
|
* Checks the status of a deep research operation.
|
|
1755
1767
|
* @param id - The ID of the deep research operation.
|
|
1756
1768
|
* @returns The current status and results of the research operation.
|
|
1769
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search instead.
|
|
1757
1770
|
*/
|
|
1758
1771
|
async checkDeepResearchStatus(id: string): Promise<DeepResearchStatusResponse | ErrorResponse> {
|
|
1759
1772
|
const headers = this.prepareHeaders();
|
|
@@ -1921,6 +1934,7 @@ export default class FirecrawlApp {
|
|
|
1921
1934
|
* @param url - The URL to generate LLMs.txt from.
|
|
1922
1935
|
* @param params - Parameters for the LLMs.txt generation operation.
|
|
1923
1936
|
* @returns The final generation results.
|
|
1937
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
1924
1938
|
*/
|
|
1925
1939
|
async generateLLMsText(url: string, params?: GenerateLLMsTextParams): Promise<GenerateLLMsTextStatusResponse | ErrorResponse> {
|
|
1926
1940
|
try {
|
|
@@ -1973,6 +1987,7 @@ export default class FirecrawlApp {
|
|
|
1973
1987
|
* @param url - The URL to generate LLMs.txt from.
|
|
1974
1988
|
* @param params - Parameters for the LLMs.txt generation operation.
|
|
1975
1989
|
* @returns The response containing the generation job ID.
|
|
1990
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
1976
1991
|
*/
|
|
1977
1992
|
async asyncGenerateLLMsText(url: string, params?: GenerateLLMsTextParams): Promise<GenerateLLMsTextResponse | ErrorResponse> {
|
|
1978
1993
|
const headers = this.prepareHeaders();
|
|
@@ -2003,6 +2018,7 @@ export default class FirecrawlApp {
|
|
|
2003
2018
|
* Checks the status of a LLMs.txt generation operation.
|
|
2004
2019
|
* @param id - The ID of the LLMs.txt generation operation.
|
|
2005
2020
|
* @returns The current status and results of the generation operation.
|
|
2021
|
+
* @deprecated /v1/llmstxt is deprecated and will not be replaced.
|
|
2006
2022
|
*/
|
|
2007
2023
|
async checkGenerateLLMsTextStatus(id: string): Promise<GenerateLLMsTextStatusResponse | ErrorResponse> {
|
|
2008
2024
|
const headers = this.prepareHeaders();
|
package/src/v2/client.ts
CHANGED
|
@@ -204,6 +204,7 @@ export class FirecrawlClient {
|
|
|
204
204
|
* @param file File payload (data, filename, optional contentType).
|
|
205
205
|
* @param options Optional parse options (formats, parsers, etc.).
|
|
206
206
|
* Note: parse does not support changeTracking, screenshot, branding,
|
|
207
|
+
* audio, video,
|
|
207
208
|
* actions, waitFor, location, or mobile options.
|
|
208
209
|
* @returns Parsed document with requested formats.
|
|
209
210
|
*/
|
package/src/v2/types.ts
CHANGED
|
@@ -13,7 +13,8 @@ export type FormatString =
|
|
|
13
13
|
| 'json'
|
|
14
14
|
| 'attributes'
|
|
15
15
|
| 'branding'
|
|
16
|
-
| 'audio'
|
|
16
|
+
| 'audio'
|
|
17
|
+
| 'video';
|
|
17
18
|
|
|
18
19
|
export interface Viewport {
|
|
19
20
|
width: number;
|
|
@@ -82,7 +83,7 @@ export type FormatOption =
|
|
|
82
83
|
|
|
83
84
|
export type ParseFormatString = Exclude<
|
|
84
85
|
FormatString,
|
|
85
|
-
'screenshot' | 'changeTracking' | 'branding'
|
|
86
|
+
'screenshot' | 'changeTracking' | 'branding' | 'audio' | 'video'
|
|
86
87
|
>;
|
|
87
88
|
|
|
88
89
|
export interface ParseFormat {
|
|
@@ -458,6 +459,7 @@ export interface Document {
|
|
|
458
459
|
images?: string[];
|
|
459
460
|
screenshot?: string;
|
|
460
461
|
audio?: string;
|
|
462
|
+
video?: string;
|
|
461
463
|
attributes?: Array<{
|
|
462
464
|
selector: string;
|
|
463
465
|
attribute: string;
|
|
@@ -777,6 +779,8 @@ export interface ExtractResponse {
|
|
|
777
779
|
data?: unknown;
|
|
778
780
|
error?: string;
|
|
779
781
|
warning?: string;
|
|
782
|
+
warnings?: string[];
|
|
783
|
+
replacement?: string;
|
|
780
784
|
sources?: Record<string, unknown>;
|
|
781
785
|
expiresAt?: string;
|
|
782
786
|
creditsUsed?: number;
|
|
@@ -114,6 +114,9 @@ export function ensureValidParseFormats(formats?: ParseFormatOption[]): void {
|
|
|
114
114
|
if (fmt === "branding") {
|
|
115
115
|
throw new Error("parse does not support branding format");
|
|
116
116
|
}
|
|
117
|
+
if (fmt === "audio" || fmt === "video") {
|
|
118
|
+
throw new Error(`parse does not support ${fmt} format`);
|
|
119
|
+
}
|
|
117
120
|
continue;
|
|
118
121
|
}
|
|
119
122
|
|
|
@@ -127,6 +130,9 @@ export function ensureValidParseFormats(formats?: ParseFormatOption[]): void {
|
|
|
127
130
|
if (type === "branding") {
|
|
128
131
|
throw new Error("parse does not support branding format");
|
|
129
132
|
}
|
|
133
|
+
if (type === "audio" || type === "video") {
|
|
134
|
+
throw new Error(`parse does not support ${type} format`);
|
|
135
|
+
}
|
|
130
136
|
|
|
131
137
|
if ((fmt as JsonFormat).type === "json") {
|
|
132
138
|
const j = fmt as JsonFormat;
|