@mendable/firecrawl-js 4.32.0 → 4.32.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 +67 -0
- package/dist/{chunk-DBXKWZGC.js → chunk-S7CQ7Q2W.js} +17 -3
- package/dist/index.cjs +47 -11
- package/dist/index.d.cts +107 -15
- package/dist/index.d.ts +107 -15
- package/dist/index.js +32 -10
- package/dist/{package-L37ZVTF4.js → package-KQCMZM5L.js} +1 -1
- package/package.json +17 -3
- package/pnpm-workspace.yaml +3 -2
- package/src/v1/index.ts +3 -3
- package/src/v2/client.ts +13 -2
- package/src/v2/methods/research.ts +38 -6
- package/src/v2/types.ts +53 -4
package/README.md
CHANGED
|
@@ -166,6 +166,73 @@ const mapResult = await app.map('https://example.com');
|
|
|
166
166
|
console.log(mapResult);
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
+
### Search
|
|
170
|
+
|
|
171
|
+
Use `search` to search the web and optionally scrape the results in the same call.
|
|
172
|
+
|
|
173
|
+
```js
|
|
174
|
+
const results = await app.search('what is retrieval augmented generation?', { limit: 5 });
|
|
175
|
+
for (const result of results.web ?? []) {
|
|
176
|
+
console.log(result.url, '-', result.title);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Scrape every result as part of the search:
|
|
180
|
+
const scraped = await app.search('firecrawl changelog', {
|
|
181
|
+
limit: 3,
|
|
182
|
+
scrapeOptions: { formats: ['markdown'] },
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Results are grouped by source: `.web`, `.news`, `.images` and `.developer`.
|
|
187
|
+
|
|
188
|
+
Use `categories` to narrow web search to a kind of site:
|
|
189
|
+
|
|
190
|
+
```js
|
|
191
|
+
const results = await app.search('nanopore basecalling accuracy', {
|
|
192
|
+
categories: ['research'],
|
|
193
|
+
});
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
> **`categories: ['research']` is a website filter, not the paper index.** It
|
|
197
|
+
> restricts ordinary web search to roughly 14 academic domains (arxiv.org,
|
|
198
|
+
> pubmed.ncbi.nlm.nih.gov, nature.com, biorxiv.org, ...) and returns web page
|
|
199
|
+
> results. To search papers themselves, use `research.searchPapers` below.
|
|
200
|
+
|
|
201
|
+
### Research / paper search
|
|
202
|
+
|
|
203
|
+
Use `app.research` to search Firecrawl's research paper index: ~43M paper
|
|
204
|
+
abstracts, roughly 90% biomedical and life sciences (PubMed, bioRxiv, medRxiv),
|
|
205
|
+
plus arXiv for physics, mathematics and computer science.
|
|
206
|
+
|
|
207
|
+
```js
|
|
208
|
+
// Search the paper index (semantic search over abstracts):
|
|
209
|
+
const papers = await app.research.searchPapers(
|
|
210
|
+
'CRISPR base editing off-target effects in primary human T cells',
|
|
211
|
+
{ k: 10 },
|
|
212
|
+
);
|
|
213
|
+
for (const paper of papers.results) {
|
|
214
|
+
console.log(paper.primaryId, '-', paper.title);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Inspect one paper's metadata (accepts pmid:, pmcid:, doi: or arxiv: ids):
|
|
218
|
+
const paper = await app.research.getPaper('pmid:<id>');
|
|
219
|
+
|
|
220
|
+
// Read the passages inside a paper that answer a specific question:
|
|
221
|
+
const read = await app.research.getPaper('pmid:<id>', {
|
|
222
|
+
query: 'what was the primary endpoint and the reported hazard ratio?',
|
|
223
|
+
k: 4,
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// Expand along the citation graph, re-ranked for your stated intent:
|
|
227
|
+
const related = await app.research.similarPapers('pmid:<id>', {
|
|
228
|
+
intent: 'replication attempts in larger cohorts',
|
|
229
|
+
k: 20,
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
A companion `app.research.searchGithub` searches indexed GitHub issue/PR history
|
|
234
|
+
and repository readmes.
|
|
235
|
+
|
|
169
236
|
### Scrape-bound interactive browsing (v2)
|
|
170
237
|
|
|
171
238
|
Use a scrape job ID to keep interacting with the replayed browser context:
|
|
@@ -12,8 +12,8 @@ var require_package = __commonJS({
|
|
|
12
12
|
"package.json"(exports, module) {
|
|
13
13
|
module.exports = {
|
|
14
14
|
name: "@mendable/firecrawl-js",
|
|
15
|
-
version: "4.32.
|
|
16
|
-
description: "JavaScript SDK for Firecrawl API",
|
|
15
|
+
version: "4.32.1",
|
|
16
|
+
description: "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
|
|
17
17
|
main: "dist/index.js",
|
|
18
18
|
types: "dist/index.d.ts",
|
|
19
19
|
exports: {
|
|
@@ -69,7 +69,21 @@ var require_package = __commonJS({
|
|
|
69
69
|
"web",
|
|
70
70
|
"scraper",
|
|
71
71
|
"api",
|
|
72
|
-
"sdk"
|
|
72
|
+
"sdk",
|
|
73
|
+
"web-search",
|
|
74
|
+
"literature-search",
|
|
75
|
+
"research",
|
|
76
|
+
"scientific-papers",
|
|
77
|
+
"academic-search",
|
|
78
|
+
"biomedical",
|
|
79
|
+
"life-sciences",
|
|
80
|
+
"pubmed",
|
|
81
|
+
"biorxiv",
|
|
82
|
+
"medrxiv",
|
|
83
|
+
"arxiv",
|
|
84
|
+
"preprints",
|
|
85
|
+
"citations",
|
|
86
|
+
"bioinformatics"
|
|
73
87
|
],
|
|
74
88
|
engines: {
|
|
75
89
|
node: ">=22.0.0"
|
package/dist/index.cjs
CHANGED
|
@@ -39,8 +39,8 @@ var require_package = __commonJS({
|
|
|
39
39
|
"package.json"(exports2, module2) {
|
|
40
40
|
module2.exports = {
|
|
41
41
|
name: "@mendable/firecrawl-js",
|
|
42
|
-
version: "4.32.
|
|
43
|
-
description: "JavaScript SDK for Firecrawl API",
|
|
42
|
+
version: "4.32.1",
|
|
43
|
+
description: "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
|
|
44
44
|
main: "dist/index.js",
|
|
45
45
|
types: "dist/index.d.ts",
|
|
46
46
|
exports: {
|
|
@@ -96,7 +96,21 @@ var require_package = __commonJS({
|
|
|
96
96
|
"web",
|
|
97
97
|
"scraper",
|
|
98
98
|
"api",
|
|
99
|
-
"sdk"
|
|
99
|
+
"sdk",
|
|
100
|
+
"web-search",
|
|
101
|
+
"literature-search",
|
|
102
|
+
"research",
|
|
103
|
+
"scientific-papers",
|
|
104
|
+
"academic-search",
|
|
105
|
+
"biomedical",
|
|
106
|
+
"life-sciences",
|
|
107
|
+
"pubmed",
|
|
108
|
+
"biorxiv",
|
|
109
|
+
"medrxiv",
|
|
110
|
+
"arxiv",
|
|
111
|
+
"preprints",
|
|
112
|
+
"citations",
|
|
113
|
+
"bioinformatics"
|
|
100
114
|
],
|
|
101
115
|
engines: {
|
|
102
116
|
node: ">=22.0.0"
|
|
@@ -1519,9 +1533,20 @@ var ResearchClient = class {
|
|
|
1519
1533
|
}
|
|
1520
1534
|
http;
|
|
1521
1535
|
/**
|
|
1522
|
-
* Search
|
|
1523
|
-
*
|
|
1524
|
-
*
|
|
1536
|
+
* Search the research paper index by abstract relevance.
|
|
1537
|
+
*
|
|
1538
|
+
* Queries ~43M paper abstracts: PubMed, bioRxiv and medRxiv (about 90% of the
|
|
1539
|
+
* corpus — biomedical and life sciences) plus arXiv (physics, mathematics,
|
|
1540
|
+
* computer science). Semantic search over abstracts, not keyword matching.
|
|
1541
|
+
*
|
|
1542
|
+
* This is **not** `search({ categories: ["research"] })`, which only narrows
|
|
1543
|
+
* ordinary web search to ~14 academic websites.
|
|
1544
|
+
*
|
|
1545
|
+
* @param query Natural-language search query, e.g. `"CRISPR base editing
|
|
1546
|
+
* off-target effects in primary human T cells"`.
|
|
1547
|
+
* @param options Optional filters (k, authors, categories, from, to). Note
|
|
1548
|
+
* `categories` here filters *paper* subject categories (e.g. `"q-bio.GN"`)
|
|
1549
|
+
* and is unrelated to the `categories` option of `search()`.
|
|
1525
1550
|
*/
|
|
1526
1551
|
async searchPapers(query, options = {}) {
|
|
1527
1552
|
if (!query || !query.trim()) throw new Error("query cannot be empty");
|
|
@@ -2071,8 +2096,19 @@ var FirecrawlClient = class {
|
|
|
2071
2096
|
}
|
|
2072
2097
|
// Research
|
|
2073
2098
|
/**
|
|
2074
|
-
* Access the v2 research endpoints
|
|
2075
|
-
*
|
|
2099
|
+
* Access the v2 research endpoints — Firecrawl's **research paper index**
|
|
2100
|
+
* (~43M paper abstracts) plus GitHub history/readmes.
|
|
2101
|
+
*
|
|
2102
|
+
* The paper corpus is roughly 90% biomedical and life sciences — PubMed,
|
|
2103
|
+
* bioRxiv and medRxiv — with arXiv covering physics, mathematics and
|
|
2104
|
+
* computer science.
|
|
2105
|
+
*
|
|
2106
|
+
* ⚠️ Not the same as `search({ categories: ["research"] })`, which is only a
|
|
2107
|
+
* website/domain filter over ordinary web search (~14 academic domains,
|
|
2108
|
+
* returning page snippets). Use `research.searchPapers()` for literature
|
|
2109
|
+
* search.
|
|
2110
|
+
*
|
|
2111
|
+
* Example: `firecrawl.research.searchPapers("GLP-1 receptor agonists cardiovascular outcomes")`.
|
|
2076
2112
|
*/
|
|
2077
2113
|
get research() {
|
|
2078
2114
|
if (!this._research) this._research = new ResearchClient(this.http);
|
|
@@ -3263,7 +3299,7 @@ var FirecrawlApp = class {
|
|
|
3263
3299
|
* @param onActivity - Optional callback to receive activity updates in real-time.
|
|
3264
3300
|
* @param onSource - Optional callback to receive source updates in real-time.
|
|
3265
3301
|
* @returns The final research results.
|
|
3266
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
3302
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
3267
3303
|
*/
|
|
3268
3304
|
async deepResearch(query, params, onActivity, onSource) {
|
|
3269
3305
|
try {
|
|
@@ -3320,7 +3356,7 @@ var FirecrawlApp = class {
|
|
|
3320
3356
|
* Initiates a deep research operation on a given query without polling.
|
|
3321
3357
|
* @param params - Parameters for the deep research operation.
|
|
3322
3358
|
* @returns The response containing the research job ID.
|
|
3323
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
3359
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
3324
3360
|
*/
|
|
3325
3361
|
async asyncDeepResearch(query, params) {
|
|
3326
3362
|
const headers = this.prepareHeaders();
|
|
@@ -3358,7 +3394,7 @@ var FirecrawlApp = class {
|
|
|
3358
3394
|
* Checks the status of a deep research operation.
|
|
3359
3395
|
* @param id - The ID of the deep research operation.
|
|
3360
3396
|
* @returns The current status and results of the research operation.
|
|
3361
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
3397
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
3362
3398
|
*/
|
|
3363
3399
|
async checkDeepResearchStatus(id) {
|
|
3364
3400
|
const headers = this.prepareHeaders();
|
package/dist/index.d.cts
CHANGED
|
@@ -139,6 +139,10 @@ interface ScrapeOptions {
|
|
|
139
139
|
useMock?: string;
|
|
140
140
|
blockAds?: boolean;
|
|
141
141
|
proxy?: "basic" | "stealth" | "enhanced" | "auto" | string;
|
|
142
|
+
/**
|
|
143
|
+
* Maximum age, in milliseconds, of indexed content that may be reused.
|
|
144
|
+
* Set to `0` to bypass index reuse.
|
|
145
|
+
*/
|
|
142
146
|
maxAge?: number;
|
|
143
147
|
minAge?: number;
|
|
144
148
|
storeInCache?: boolean;
|
|
@@ -423,6 +427,7 @@ interface MenuProfile {
|
|
|
423
427
|
interface DocumentMetadata {
|
|
424
428
|
title?: string;
|
|
425
429
|
description?: string;
|
|
430
|
+
/** URL reported by the selected scrape engine. */
|
|
426
431
|
url?: string;
|
|
427
432
|
language?: string;
|
|
428
433
|
keywords?: string | string[];
|
|
@@ -452,7 +457,9 @@ interface DocumentMetadata {
|
|
|
452
457
|
publishedTime?: string;
|
|
453
458
|
articleTag?: string;
|
|
454
459
|
articleSection?: string;
|
|
460
|
+
/** URL requested for the scrape. */
|
|
455
461
|
sourceURL?: string;
|
|
462
|
+
/** HTTP status code reported for the scrape response. */
|
|
456
463
|
statusCode?: number;
|
|
457
464
|
scrapeId?: string;
|
|
458
465
|
numPages?: number;
|
|
@@ -534,6 +541,28 @@ interface SearchData {
|
|
|
534
541
|
images?: Array<SearchResultImages | Document>;
|
|
535
542
|
developer?: Array<SearchResultWeb | Document>;
|
|
536
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* Narrows ordinary **web search**. A category does not switch `search()` to a
|
|
546
|
+
* different index.
|
|
547
|
+
*
|
|
548
|
+
* - `github` — restrict web results to github.com (a `site:` filter).
|
|
549
|
+
* - `research` — restrict web results to a fixed list of ~14 academic
|
|
550
|
+
* *websites* (arxiv.org, pubmed.ncbi.nlm.nih.gov, nature.com, science.org,
|
|
551
|
+
* ieee.org, sciencedirect.com, biorxiv.org, medrxiv.org, ...). It returns
|
|
552
|
+
* ordinary web page results from those domains, **not** paper records.
|
|
553
|
+
* - `pdf` — restrict results to PDFs (adds `filetype:pdf`).
|
|
554
|
+
* - `developer` — add developer results (issues, pull requests, READMEs and
|
|
555
|
+
* documentation) under `.developer`.
|
|
556
|
+
*
|
|
557
|
+
* ⚠️ `categories: ["research"]` is **not** Firecrawl's research paper index.
|
|
558
|
+
* To search papers themselves — ~43M abstracts, roughly 90% biomedical
|
|
559
|
+
* (PubMed, bioRxiv, medRxiv) plus arXiv — with full abstracts, in-body passage
|
|
560
|
+
* reads and citation-graph expansion, use `firecrawl.research.searchPapers()`
|
|
561
|
+
* (plus `getPaper()` and `similarPapers()`), which call `/v2/search/research`.
|
|
562
|
+
*
|
|
563
|
+
* Rule of thumb: literature search → `research.searchPapers()`; web pages that
|
|
564
|
+
* happen to live on academic domains → `search({ categories: ["research"] })`.
|
|
565
|
+
*/
|
|
537
566
|
interface CategoryOption {
|
|
538
567
|
type: "github" | "research" | "pdf" | "developer";
|
|
539
568
|
}
|
|
@@ -542,6 +571,14 @@ interface SearchRequest {
|
|
|
542
571
|
sources?: Array<"web" | "news" | "images" | {
|
|
543
572
|
type: "web" | "news" | "images";
|
|
544
573
|
}>;
|
|
574
|
+
/**
|
|
575
|
+
* Narrow web search by category. See {@link CategoryOption}.
|
|
576
|
+
*
|
|
577
|
+
* ⚠️ `"research"` is a website/domain filter over ordinary web search (~14
|
|
578
|
+
* academic domains), **not** the research paper index. For literature search
|
|
579
|
+
* over ~43M paper abstracts (PubMed / bioRxiv / medRxiv / arXiv) use
|
|
580
|
+
* `firecrawl.research.searchPapers()` instead.
|
|
581
|
+
*/
|
|
545
582
|
categories?: Array<"github" | "research" | "pdf" | "developer" | CategoryOption>;
|
|
546
583
|
includeDomains?: string[];
|
|
547
584
|
excludeDomains?: string[];
|
|
@@ -1088,8 +1125,20 @@ interface BrowserListResponse {
|
|
|
1088
1125
|
error?: string;
|
|
1089
1126
|
}
|
|
1090
1127
|
/**
|
|
1091
|
-
* Source identifiers grouped by namespace.
|
|
1092
|
-
*
|
|
1128
|
+
* Source identifiers grouped by namespace. Each key is a namespace and each
|
|
1129
|
+
* value is an array of ids in that namespace.
|
|
1130
|
+
*
|
|
1131
|
+
* Which namespaces appear depends on the paper's source. Biomedical records
|
|
1132
|
+
* (PubMed, bioRxiv, medRxiv) typically carry `pmid`, `pmcid` and/or `doi`;
|
|
1133
|
+
* arXiv records carry `arxiv`. The set is open — treat this as a lookup by
|
|
1134
|
+
* namespace rather than a fixed schema, and prefer {@link PaperResult.primaryId}
|
|
1135
|
+
* when you just need one citable identifier.
|
|
1136
|
+
*
|
|
1137
|
+
* @example
|
|
1138
|
+
* ```ts
|
|
1139
|
+
* const doi = paper.ids?.doi?.[0];
|
|
1140
|
+
* const pmid = paper.ids?.pmid?.[0];
|
|
1141
|
+
* ```
|
|
1093
1142
|
*/
|
|
1094
1143
|
type IdMap = Record<string, string[]>;
|
|
1095
1144
|
/** Per-candidate ranking signals (present on similarity results). */
|
|
@@ -1103,7 +1152,7 @@ interface PaperSignals {
|
|
|
1103
1152
|
/** Number of distinct seeds connected to this candidate. */
|
|
1104
1153
|
seedOverlap: number;
|
|
1105
1154
|
}
|
|
1106
|
-
/** A ranked paper. `paperId` is canonical;
|
|
1155
|
+
/** A ranked paper. `paperId` is canonical; source ids (pmid, pmcid, doi, arxiv, ...) live in `ids`. */
|
|
1107
1156
|
interface PaperResult {
|
|
1108
1157
|
/** Canonical paper id — the Milvus INT64 primary key as a decimal string. */
|
|
1109
1158
|
paperId: string;
|
|
@@ -1175,7 +1224,7 @@ interface GitHubScoreBreakdown {
|
|
|
1175
1224
|
rerank?: number;
|
|
1176
1225
|
}
|
|
1177
1226
|
interface GitHubSearchItem {
|
|
1178
|
-
resultType
|
|
1227
|
+
resultType?: "github_history" | "repo_readme" | "web";
|
|
1179
1228
|
/** `owner/name`; empty for web results whose URL is not a repo page. */
|
|
1180
1229
|
repo: string;
|
|
1181
1230
|
url: string;
|
|
@@ -1326,23 +1375,55 @@ declare function listBrowsers(http: HttpClient, args?: {
|
|
|
1326
1375
|
}): Promise<BrowserListResponse>;
|
|
1327
1376
|
|
|
1328
1377
|
/**
|
|
1329
|
-
* Client for the v2 research endpoints
|
|
1378
|
+
* Client for the v2 research endpoints — Firecrawl's **research paper index**
|
|
1379
|
+
* (~43M paper abstracts) plus GitHub history/readmes.
|
|
1380
|
+
*
|
|
1381
|
+
* The paper corpus is roughly 90% biomedical and life sciences — PubMed,
|
|
1382
|
+
* bioRxiv and medRxiv — with arXiv covering physics, mathematics and computer
|
|
1383
|
+
* science. Supports abstract search, paper metadata, in-body passage reads and
|
|
1384
|
+
* citation-graph expansion.
|
|
1385
|
+
*
|
|
1386
|
+
* ⚠️ This is **not** the same as `search({ categories: ["research"] })`. That
|
|
1387
|
+
* option is a website/domain filter on ordinary web search: it narrows
|
|
1388
|
+
* Google-style results to ~14 academic domains and returns page snippets. The
|
|
1389
|
+
* methods here query the paper index itself and return ranked paper records.
|
|
1390
|
+
*
|
|
1330
1391
|
* Accessed via `firecrawl.research`.
|
|
1392
|
+
*
|
|
1393
|
+
* @example
|
|
1394
|
+
* ```ts
|
|
1395
|
+
* const res = await firecrawl.research.searchPapers(
|
|
1396
|
+
* "tau aggregation inhibitors in Alzheimer's disease",
|
|
1397
|
+
* { k: 10 },
|
|
1398
|
+
* );
|
|
1399
|
+
* ```
|
|
1331
1400
|
*/
|
|
1332
1401
|
declare class ResearchClient {
|
|
1333
1402
|
private readonly http;
|
|
1334
1403
|
constructor(http: HttpClient);
|
|
1335
1404
|
/**
|
|
1336
|
-
* Search
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1405
|
+
* Search the research paper index by abstract relevance.
|
|
1406
|
+
*
|
|
1407
|
+
* Queries ~43M paper abstracts: PubMed, bioRxiv and medRxiv (about 90% of the
|
|
1408
|
+
* corpus — biomedical and life sciences) plus arXiv (physics, mathematics,
|
|
1409
|
+
* computer science). Semantic search over abstracts, not keyword matching.
|
|
1410
|
+
*
|
|
1411
|
+
* This is **not** `search({ categories: ["research"] })`, which only narrows
|
|
1412
|
+
* ordinary web search to ~14 academic websites.
|
|
1413
|
+
*
|
|
1414
|
+
* @param query Natural-language search query, e.g. `"CRISPR base editing
|
|
1415
|
+
* off-target effects in primary human T cells"`.
|
|
1416
|
+
* @param options Optional filters (k, authors, categories, from, to). Note
|
|
1417
|
+
* `categories` here filters *paper* subject categories (e.g. `"q-bio.GN"`)
|
|
1418
|
+
* and is unrelated to the `categories` option of `search()`.
|
|
1339
1419
|
*/
|
|
1340
1420
|
searchPapers(query: string, options?: SearchPapersOptions): Promise<SearchPapersResponse>;
|
|
1341
1421
|
/**
|
|
1342
1422
|
* Get paper metadata (detail mode), or read in-body passages (when `query` is
|
|
1343
1423
|
* supplied). `k` is only valid together with `query`.
|
|
1344
|
-
* @param id Paper reference: a canonical `
|
|
1345
|
-
*
|
|
1424
|
+
* @param id Paper reference: a canonical `paperId`, or a namespaced id key
|
|
1425
|
+
* such as `pmid:<id>`, `pmcid:<id>`, `doi:<doi>` or `arxiv:<id>`. Bare
|
|
1426
|
+
* arXiv ids and arXiv URLs are also accepted.
|
|
1346
1427
|
* @param options Optional `query` (switches to read mode) and `k`.
|
|
1347
1428
|
*/
|
|
1348
1429
|
getPaper(id: string, options?: {
|
|
@@ -1497,8 +1578,19 @@ declare class FirecrawlClient {
|
|
|
1497
1578
|
*/
|
|
1498
1579
|
searchFeedback(jobId: string, request: SearchFeedbackRequest): Promise<FeedbackResponse>;
|
|
1499
1580
|
/**
|
|
1500
|
-
* Access the v2 research endpoints
|
|
1501
|
-
*
|
|
1581
|
+
* Access the v2 research endpoints — Firecrawl's **research paper index**
|
|
1582
|
+
* (~43M paper abstracts) plus GitHub history/readmes.
|
|
1583
|
+
*
|
|
1584
|
+
* The paper corpus is roughly 90% biomedical and life sciences — PubMed,
|
|
1585
|
+
* bioRxiv and medRxiv — with arXiv covering physics, mathematics and
|
|
1586
|
+
* computer science.
|
|
1587
|
+
*
|
|
1588
|
+
* ⚠️ Not the same as `search({ categories: ["research"] })`, which is only a
|
|
1589
|
+
* website/domain filter over ordinary web search (~14 academic domains,
|
|
1590
|
+
* returning page snippets). Use `research.searchPapers()` for literature
|
|
1591
|
+
* search.
|
|
1592
|
+
*
|
|
1593
|
+
* Example: `firecrawl.research.searchPapers("GLP-1 receptor agonists cardiovascular outcomes")`.
|
|
1502
1594
|
*/
|
|
1503
1595
|
get research(): ResearchClient;
|
|
1504
1596
|
/**
|
|
@@ -2527,7 +2619,7 @@ declare class FirecrawlApp {
|
|
|
2527
2619
|
* @param onActivity - Optional callback to receive activity updates in real-time.
|
|
2528
2620
|
* @param onSource - Optional callback to receive source updates in real-time.
|
|
2529
2621
|
* @returns The final research results.
|
|
2530
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
2622
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
2531
2623
|
*/
|
|
2532
2624
|
deepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>, onActivity?: (activity: {
|
|
2533
2625
|
type: string;
|
|
@@ -2545,14 +2637,14 @@ declare class FirecrawlApp {
|
|
|
2545
2637
|
* Initiates a deep research operation on a given query without polling.
|
|
2546
2638
|
* @param params - Parameters for the deep research operation.
|
|
2547
2639
|
* @returns The response containing the research job ID.
|
|
2548
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
2640
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
2549
2641
|
*/
|
|
2550
2642
|
asyncDeepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>): Promise<DeepResearchResponse | ErrorResponse>;
|
|
2551
2643
|
/**
|
|
2552
2644
|
* Checks the status of a deep research operation.
|
|
2553
2645
|
* @param id - The ID of the deep research operation.
|
|
2554
2646
|
* @returns The current status and results of the research operation.
|
|
2555
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
2647
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
2556
2648
|
*/
|
|
2557
2649
|
checkDeepResearchStatus(id: string): Promise<DeepResearchStatusResponse | ErrorResponse>;
|
|
2558
2650
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -139,6 +139,10 @@ interface ScrapeOptions {
|
|
|
139
139
|
useMock?: string;
|
|
140
140
|
blockAds?: boolean;
|
|
141
141
|
proxy?: "basic" | "stealth" | "enhanced" | "auto" | string;
|
|
142
|
+
/**
|
|
143
|
+
* Maximum age, in milliseconds, of indexed content that may be reused.
|
|
144
|
+
* Set to `0` to bypass index reuse.
|
|
145
|
+
*/
|
|
142
146
|
maxAge?: number;
|
|
143
147
|
minAge?: number;
|
|
144
148
|
storeInCache?: boolean;
|
|
@@ -423,6 +427,7 @@ interface MenuProfile {
|
|
|
423
427
|
interface DocumentMetadata {
|
|
424
428
|
title?: string;
|
|
425
429
|
description?: string;
|
|
430
|
+
/** URL reported by the selected scrape engine. */
|
|
426
431
|
url?: string;
|
|
427
432
|
language?: string;
|
|
428
433
|
keywords?: string | string[];
|
|
@@ -452,7 +457,9 @@ interface DocumentMetadata {
|
|
|
452
457
|
publishedTime?: string;
|
|
453
458
|
articleTag?: string;
|
|
454
459
|
articleSection?: string;
|
|
460
|
+
/** URL requested for the scrape. */
|
|
455
461
|
sourceURL?: string;
|
|
462
|
+
/** HTTP status code reported for the scrape response. */
|
|
456
463
|
statusCode?: number;
|
|
457
464
|
scrapeId?: string;
|
|
458
465
|
numPages?: number;
|
|
@@ -534,6 +541,28 @@ interface SearchData {
|
|
|
534
541
|
images?: Array<SearchResultImages | Document>;
|
|
535
542
|
developer?: Array<SearchResultWeb | Document>;
|
|
536
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* Narrows ordinary **web search**. A category does not switch `search()` to a
|
|
546
|
+
* different index.
|
|
547
|
+
*
|
|
548
|
+
* - `github` — restrict web results to github.com (a `site:` filter).
|
|
549
|
+
* - `research` — restrict web results to a fixed list of ~14 academic
|
|
550
|
+
* *websites* (arxiv.org, pubmed.ncbi.nlm.nih.gov, nature.com, science.org,
|
|
551
|
+
* ieee.org, sciencedirect.com, biorxiv.org, medrxiv.org, ...). It returns
|
|
552
|
+
* ordinary web page results from those domains, **not** paper records.
|
|
553
|
+
* - `pdf` — restrict results to PDFs (adds `filetype:pdf`).
|
|
554
|
+
* - `developer` — add developer results (issues, pull requests, READMEs and
|
|
555
|
+
* documentation) under `.developer`.
|
|
556
|
+
*
|
|
557
|
+
* ⚠️ `categories: ["research"]` is **not** Firecrawl's research paper index.
|
|
558
|
+
* To search papers themselves — ~43M abstracts, roughly 90% biomedical
|
|
559
|
+
* (PubMed, bioRxiv, medRxiv) plus arXiv — with full abstracts, in-body passage
|
|
560
|
+
* reads and citation-graph expansion, use `firecrawl.research.searchPapers()`
|
|
561
|
+
* (plus `getPaper()` and `similarPapers()`), which call `/v2/search/research`.
|
|
562
|
+
*
|
|
563
|
+
* Rule of thumb: literature search → `research.searchPapers()`; web pages that
|
|
564
|
+
* happen to live on academic domains → `search({ categories: ["research"] })`.
|
|
565
|
+
*/
|
|
537
566
|
interface CategoryOption {
|
|
538
567
|
type: "github" | "research" | "pdf" | "developer";
|
|
539
568
|
}
|
|
@@ -542,6 +571,14 @@ interface SearchRequest {
|
|
|
542
571
|
sources?: Array<"web" | "news" | "images" | {
|
|
543
572
|
type: "web" | "news" | "images";
|
|
544
573
|
}>;
|
|
574
|
+
/**
|
|
575
|
+
* Narrow web search by category. See {@link CategoryOption}.
|
|
576
|
+
*
|
|
577
|
+
* ⚠️ `"research"` is a website/domain filter over ordinary web search (~14
|
|
578
|
+
* academic domains), **not** the research paper index. For literature search
|
|
579
|
+
* over ~43M paper abstracts (PubMed / bioRxiv / medRxiv / arXiv) use
|
|
580
|
+
* `firecrawl.research.searchPapers()` instead.
|
|
581
|
+
*/
|
|
545
582
|
categories?: Array<"github" | "research" | "pdf" | "developer" | CategoryOption>;
|
|
546
583
|
includeDomains?: string[];
|
|
547
584
|
excludeDomains?: string[];
|
|
@@ -1088,8 +1125,20 @@ interface BrowserListResponse {
|
|
|
1088
1125
|
error?: string;
|
|
1089
1126
|
}
|
|
1090
1127
|
/**
|
|
1091
|
-
* Source identifiers grouped by namespace.
|
|
1092
|
-
*
|
|
1128
|
+
* Source identifiers grouped by namespace. Each key is a namespace and each
|
|
1129
|
+
* value is an array of ids in that namespace.
|
|
1130
|
+
*
|
|
1131
|
+
* Which namespaces appear depends on the paper's source. Biomedical records
|
|
1132
|
+
* (PubMed, bioRxiv, medRxiv) typically carry `pmid`, `pmcid` and/or `doi`;
|
|
1133
|
+
* arXiv records carry `arxiv`. The set is open — treat this as a lookup by
|
|
1134
|
+
* namespace rather than a fixed schema, and prefer {@link PaperResult.primaryId}
|
|
1135
|
+
* when you just need one citable identifier.
|
|
1136
|
+
*
|
|
1137
|
+
* @example
|
|
1138
|
+
* ```ts
|
|
1139
|
+
* const doi = paper.ids?.doi?.[0];
|
|
1140
|
+
* const pmid = paper.ids?.pmid?.[0];
|
|
1141
|
+
* ```
|
|
1093
1142
|
*/
|
|
1094
1143
|
type IdMap = Record<string, string[]>;
|
|
1095
1144
|
/** Per-candidate ranking signals (present on similarity results). */
|
|
@@ -1103,7 +1152,7 @@ interface PaperSignals {
|
|
|
1103
1152
|
/** Number of distinct seeds connected to this candidate. */
|
|
1104
1153
|
seedOverlap: number;
|
|
1105
1154
|
}
|
|
1106
|
-
/** A ranked paper. `paperId` is canonical;
|
|
1155
|
+
/** A ranked paper. `paperId` is canonical; source ids (pmid, pmcid, doi, arxiv, ...) live in `ids`. */
|
|
1107
1156
|
interface PaperResult {
|
|
1108
1157
|
/** Canonical paper id — the Milvus INT64 primary key as a decimal string. */
|
|
1109
1158
|
paperId: string;
|
|
@@ -1175,7 +1224,7 @@ interface GitHubScoreBreakdown {
|
|
|
1175
1224
|
rerank?: number;
|
|
1176
1225
|
}
|
|
1177
1226
|
interface GitHubSearchItem {
|
|
1178
|
-
resultType
|
|
1227
|
+
resultType?: "github_history" | "repo_readme" | "web";
|
|
1179
1228
|
/** `owner/name`; empty for web results whose URL is not a repo page. */
|
|
1180
1229
|
repo: string;
|
|
1181
1230
|
url: string;
|
|
@@ -1326,23 +1375,55 @@ declare function listBrowsers(http: HttpClient, args?: {
|
|
|
1326
1375
|
}): Promise<BrowserListResponse>;
|
|
1327
1376
|
|
|
1328
1377
|
/**
|
|
1329
|
-
* Client for the v2 research endpoints
|
|
1378
|
+
* Client for the v2 research endpoints — Firecrawl's **research paper index**
|
|
1379
|
+
* (~43M paper abstracts) plus GitHub history/readmes.
|
|
1380
|
+
*
|
|
1381
|
+
* The paper corpus is roughly 90% biomedical and life sciences — PubMed,
|
|
1382
|
+
* bioRxiv and medRxiv — with arXiv covering physics, mathematics and computer
|
|
1383
|
+
* science. Supports abstract search, paper metadata, in-body passage reads and
|
|
1384
|
+
* citation-graph expansion.
|
|
1385
|
+
*
|
|
1386
|
+
* ⚠️ This is **not** the same as `search({ categories: ["research"] })`. That
|
|
1387
|
+
* option is a website/domain filter on ordinary web search: it narrows
|
|
1388
|
+
* Google-style results to ~14 academic domains and returns page snippets. The
|
|
1389
|
+
* methods here query the paper index itself and return ranked paper records.
|
|
1390
|
+
*
|
|
1330
1391
|
* Accessed via `firecrawl.research`.
|
|
1392
|
+
*
|
|
1393
|
+
* @example
|
|
1394
|
+
* ```ts
|
|
1395
|
+
* const res = await firecrawl.research.searchPapers(
|
|
1396
|
+
* "tau aggregation inhibitors in Alzheimer's disease",
|
|
1397
|
+
* { k: 10 },
|
|
1398
|
+
* );
|
|
1399
|
+
* ```
|
|
1331
1400
|
*/
|
|
1332
1401
|
declare class ResearchClient {
|
|
1333
1402
|
private readonly http;
|
|
1334
1403
|
constructor(http: HttpClient);
|
|
1335
1404
|
/**
|
|
1336
|
-
* Search
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1405
|
+
* Search the research paper index by abstract relevance.
|
|
1406
|
+
*
|
|
1407
|
+
* Queries ~43M paper abstracts: PubMed, bioRxiv and medRxiv (about 90% of the
|
|
1408
|
+
* corpus — biomedical and life sciences) plus arXiv (physics, mathematics,
|
|
1409
|
+
* computer science). Semantic search over abstracts, not keyword matching.
|
|
1410
|
+
*
|
|
1411
|
+
* This is **not** `search({ categories: ["research"] })`, which only narrows
|
|
1412
|
+
* ordinary web search to ~14 academic websites.
|
|
1413
|
+
*
|
|
1414
|
+
* @param query Natural-language search query, e.g. `"CRISPR base editing
|
|
1415
|
+
* off-target effects in primary human T cells"`.
|
|
1416
|
+
* @param options Optional filters (k, authors, categories, from, to). Note
|
|
1417
|
+
* `categories` here filters *paper* subject categories (e.g. `"q-bio.GN"`)
|
|
1418
|
+
* and is unrelated to the `categories` option of `search()`.
|
|
1339
1419
|
*/
|
|
1340
1420
|
searchPapers(query: string, options?: SearchPapersOptions): Promise<SearchPapersResponse>;
|
|
1341
1421
|
/**
|
|
1342
1422
|
* Get paper metadata (detail mode), or read in-body passages (when `query` is
|
|
1343
1423
|
* supplied). `k` is only valid together with `query`.
|
|
1344
|
-
* @param id Paper reference: a canonical `
|
|
1345
|
-
*
|
|
1424
|
+
* @param id Paper reference: a canonical `paperId`, or a namespaced id key
|
|
1425
|
+
* such as `pmid:<id>`, `pmcid:<id>`, `doi:<doi>` or `arxiv:<id>`. Bare
|
|
1426
|
+
* arXiv ids and arXiv URLs are also accepted.
|
|
1346
1427
|
* @param options Optional `query` (switches to read mode) and `k`.
|
|
1347
1428
|
*/
|
|
1348
1429
|
getPaper(id: string, options?: {
|
|
@@ -1497,8 +1578,19 @@ declare class FirecrawlClient {
|
|
|
1497
1578
|
*/
|
|
1498
1579
|
searchFeedback(jobId: string, request: SearchFeedbackRequest): Promise<FeedbackResponse>;
|
|
1499
1580
|
/**
|
|
1500
|
-
* Access the v2 research endpoints
|
|
1501
|
-
*
|
|
1581
|
+
* Access the v2 research endpoints — Firecrawl's **research paper index**
|
|
1582
|
+
* (~43M paper abstracts) plus GitHub history/readmes.
|
|
1583
|
+
*
|
|
1584
|
+
* The paper corpus is roughly 90% biomedical and life sciences — PubMed,
|
|
1585
|
+
* bioRxiv and medRxiv — with arXiv covering physics, mathematics and
|
|
1586
|
+
* computer science.
|
|
1587
|
+
*
|
|
1588
|
+
* ⚠️ Not the same as `search({ categories: ["research"] })`, which is only a
|
|
1589
|
+
* website/domain filter over ordinary web search (~14 academic domains,
|
|
1590
|
+
* returning page snippets). Use `research.searchPapers()` for literature
|
|
1591
|
+
* search.
|
|
1592
|
+
*
|
|
1593
|
+
* Example: `firecrawl.research.searchPapers("GLP-1 receptor agonists cardiovascular outcomes")`.
|
|
1502
1594
|
*/
|
|
1503
1595
|
get research(): ResearchClient;
|
|
1504
1596
|
/**
|
|
@@ -2527,7 +2619,7 @@ declare class FirecrawlApp {
|
|
|
2527
2619
|
* @param onActivity - Optional callback to receive activity updates in real-time.
|
|
2528
2620
|
* @param onSource - Optional callback to receive source updates in real-time.
|
|
2529
2621
|
* @returns The final research results.
|
|
2530
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
2622
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
2531
2623
|
*/
|
|
2532
2624
|
deepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>, onActivity?: (activity: {
|
|
2533
2625
|
type: string;
|
|
@@ -2545,14 +2637,14 @@ declare class FirecrawlApp {
|
|
|
2545
2637
|
* Initiates a deep research operation on a given query without polling.
|
|
2546
2638
|
* @param params - Parameters for the deep research operation.
|
|
2547
2639
|
* @returns The response containing the research job ID.
|
|
2548
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
2640
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
2549
2641
|
*/
|
|
2550
2642
|
asyncDeepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>): Promise<DeepResearchResponse | ErrorResponse>;
|
|
2551
2643
|
/**
|
|
2552
2644
|
* Checks the status of a deep research operation.
|
|
2553
2645
|
* @param id - The ID of the deep research operation.
|
|
2554
2646
|
* @returns The current status and results of the research operation.
|
|
2555
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
2647
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
2556
2648
|
*/
|
|
2557
2649
|
checkDeepResearchStatus(id: string): Promise<DeepResearchStatusResponse | ErrorResponse>;
|
|
2558
2650
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
require_package
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-S7CQ7Q2W.js";
|
|
4
4
|
|
|
5
5
|
// src/v2/utils/httpClient.ts
|
|
6
6
|
import axios from "axios";
|
|
@@ -1402,9 +1402,20 @@ var ResearchClient = class {
|
|
|
1402
1402
|
}
|
|
1403
1403
|
http;
|
|
1404
1404
|
/**
|
|
1405
|
-
* Search
|
|
1406
|
-
*
|
|
1407
|
-
*
|
|
1405
|
+
* Search the research paper index by abstract relevance.
|
|
1406
|
+
*
|
|
1407
|
+
* Queries ~43M paper abstracts: PubMed, bioRxiv and medRxiv (about 90% of the
|
|
1408
|
+
* corpus — biomedical and life sciences) plus arXiv (physics, mathematics,
|
|
1409
|
+
* computer science). Semantic search over abstracts, not keyword matching.
|
|
1410
|
+
*
|
|
1411
|
+
* This is **not** `search({ categories: ["research"] })`, which only narrows
|
|
1412
|
+
* ordinary web search to ~14 academic websites.
|
|
1413
|
+
*
|
|
1414
|
+
* @param query Natural-language search query, e.g. `"CRISPR base editing
|
|
1415
|
+
* off-target effects in primary human T cells"`.
|
|
1416
|
+
* @param options Optional filters (k, authors, categories, from, to). Note
|
|
1417
|
+
* `categories` here filters *paper* subject categories (e.g. `"q-bio.GN"`)
|
|
1418
|
+
* and is unrelated to the `categories` option of `search()`.
|
|
1408
1419
|
*/
|
|
1409
1420
|
async searchPapers(query, options = {}) {
|
|
1410
1421
|
if (!query || !query.trim()) throw new Error("query cannot be empty");
|
|
@@ -1954,8 +1965,19 @@ var FirecrawlClient = class {
|
|
|
1954
1965
|
}
|
|
1955
1966
|
// Research
|
|
1956
1967
|
/**
|
|
1957
|
-
* Access the v2 research endpoints
|
|
1958
|
-
*
|
|
1968
|
+
* Access the v2 research endpoints — Firecrawl's **research paper index**
|
|
1969
|
+
* (~43M paper abstracts) plus GitHub history/readmes.
|
|
1970
|
+
*
|
|
1971
|
+
* The paper corpus is roughly 90% biomedical and life sciences — PubMed,
|
|
1972
|
+
* bioRxiv and medRxiv — with arXiv covering physics, mathematics and
|
|
1973
|
+
* computer science.
|
|
1974
|
+
*
|
|
1975
|
+
* ⚠️ Not the same as `search({ categories: ["research"] })`, which is only a
|
|
1976
|
+
* website/domain filter over ordinary web search (~14 academic domains,
|
|
1977
|
+
* returning page snippets). Use `research.searchPapers()` for literature
|
|
1978
|
+
* search.
|
|
1979
|
+
*
|
|
1980
|
+
* Example: `firecrawl.research.searchPapers("GLP-1 receptor agonists cardiovascular outcomes")`.
|
|
1959
1981
|
*/
|
|
1960
1982
|
get research() {
|
|
1961
1983
|
if (!this._research) this._research = new ResearchClient(this.http);
|
|
@@ -2320,7 +2342,7 @@ var FirecrawlApp = class {
|
|
|
2320
2342
|
if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
|
|
2321
2343
|
return process.env.npm_package_version;
|
|
2322
2344
|
}
|
|
2323
|
-
const packageJson = await import("./package-
|
|
2345
|
+
const packageJson = await import("./package-KQCMZM5L.js");
|
|
2324
2346
|
return packageJson.default.version;
|
|
2325
2347
|
} catch (error) {
|
|
2326
2348
|
const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
|
|
@@ -3146,7 +3168,7 @@ var FirecrawlApp = class {
|
|
|
3146
3168
|
* @param onActivity - Optional callback to receive activity updates in real-time.
|
|
3147
3169
|
* @param onSource - Optional callback to receive source updates in real-time.
|
|
3148
3170
|
* @returns The final research results.
|
|
3149
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
3171
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
3150
3172
|
*/
|
|
3151
3173
|
async deepResearch(query, params, onActivity, onSource) {
|
|
3152
3174
|
try {
|
|
@@ -3203,7 +3225,7 @@ var FirecrawlApp = class {
|
|
|
3203
3225
|
* Initiates a deep research operation on a given query without polling.
|
|
3204
3226
|
* @param params - Parameters for the deep research operation.
|
|
3205
3227
|
* @returns The response containing the research job ID.
|
|
3206
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
3228
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
3207
3229
|
*/
|
|
3208
3230
|
async asyncDeepResearch(query, params) {
|
|
3209
3231
|
const headers = this.prepareHeaders();
|
|
@@ -3241,7 +3263,7 @@ var FirecrawlApp = class {
|
|
|
3241
3263
|
* Checks the status of a deep research operation.
|
|
3242
3264
|
* @param id - The ID of the deep research operation.
|
|
3243
3265
|
* @returns The current status and results of the research operation.
|
|
3244
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
3266
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
3245
3267
|
*/
|
|
3246
3268
|
async checkDeepResearchStatus(id) {
|
|
3247
3269
|
const headers = this.prepareHeaders();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mendable/firecrawl-js",
|
|
3
|
-
"version": "4.32.
|
|
4
|
-
"description": "JavaScript SDK for Firecrawl API",
|
|
3
|
+
"version": "4.32.1",
|
|
4
|
+
"description": "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -50,7 +50,21 @@
|
|
|
50
50
|
"web",
|
|
51
51
|
"scraper",
|
|
52
52
|
"api",
|
|
53
|
-
"sdk"
|
|
53
|
+
"sdk",
|
|
54
|
+
"web-search",
|
|
55
|
+
"literature-search",
|
|
56
|
+
"research",
|
|
57
|
+
"scientific-papers",
|
|
58
|
+
"academic-search",
|
|
59
|
+
"biomedical",
|
|
60
|
+
"life-sciences",
|
|
61
|
+
"pubmed",
|
|
62
|
+
"biorxiv",
|
|
63
|
+
"medrxiv",
|
|
64
|
+
"arxiv",
|
|
65
|
+
"preprints",
|
|
66
|
+
"citations",
|
|
67
|
+
"bioinformatics"
|
|
54
68
|
],
|
|
55
69
|
"engines": {
|
|
56
70
|
"node": ">=22.0.0"
|
package/pnpm-workspace.yaml
CHANGED
|
@@ -7,8 +7,9 @@ overrides:
|
|
|
7
7
|
"rollup@<4.59.0": ">=4.59.0"
|
|
8
8
|
"picomatch@<4.0.4": ">=4.0.4"
|
|
9
9
|
handlebars: ">=4.7.9"
|
|
10
|
-
"brace-expansion@>=5.0.0 <5.0.
|
|
11
|
-
"js-yaml@>=3.0.0 <3.15.
|
|
10
|
+
"brace-expansion@>=5.0.0 <5.0.9": "5.0.9"
|
|
11
|
+
"js-yaml@>=3.0.0 <3.15.1": "3.15.1"
|
|
12
|
+
"js-yaml@>=4.0.0 <4.3.1": "4.3.1"
|
|
12
13
|
"axios@>=1.0.0 <1.16.0": "1.16.1"
|
|
13
14
|
"follow-redirects@<1.16.0": ">=1.16.0 <2.0.0"
|
|
14
15
|
"form-data@>=4.0.0 <4.0.6": "4.0.6"
|
package/src/v1/index.ts
CHANGED
|
@@ -1642,7 +1642,7 @@ export default class FirecrawlApp {
|
|
|
1642
1642
|
* @param onActivity - Optional callback to receive activity updates in real-time.
|
|
1643
1643
|
* @param onSource - Optional callback to receive source updates in real-time.
|
|
1644
1644
|
* @returns The final research results.
|
|
1645
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
1645
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
1646
1646
|
*/
|
|
1647
1647
|
async deepResearch(
|
|
1648
1648
|
query: string,
|
|
@@ -1730,7 +1730,7 @@ export default class FirecrawlApp {
|
|
|
1730
1730
|
* Initiates a deep research operation on a given query without polling.
|
|
1731
1731
|
* @param params - Parameters for the deep research operation.
|
|
1732
1732
|
* @returns The response containing the research job ID.
|
|
1733
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
1733
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
1734
1734
|
*/
|
|
1735
1735
|
async asyncDeepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>): Promise<DeepResearchResponse | ErrorResponse> {
|
|
1736
1736
|
const headers = this.prepareHeaders();
|
|
@@ -1772,7 +1772,7 @@ export default class FirecrawlApp {
|
|
|
1772
1772
|
* Checks the status of a deep research operation.
|
|
1773
1773
|
* @param id - The ID of the deep research operation.
|
|
1774
1774
|
* @returns The current status and results of the research operation.
|
|
1775
|
-
* @deprecated /v1/deep-research is deprecated. Use /v2/search
|
|
1775
|
+
* @deprecated /v1/deep-research is deprecated. Use /v2/search for web research, or research.searchPapers() for scientific literature.
|
|
1776
1776
|
*/
|
|
1777
1777
|
async checkDeepResearchStatus(id: string): Promise<DeepResearchStatusResponse | ErrorResponse> {
|
|
1778
1778
|
const headers = this.prepareHeaders();
|
package/src/v2/client.ts
CHANGED
|
@@ -261,8 +261,19 @@ export class FirecrawlClient {
|
|
|
261
261
|
|
|
262
262
|
// Research
|
|
263
263
|
/**
|
|
264
|
-
* Access the v2 research endpoints
|
|
265
|
-
*
|
|
264
|
+
* Access the v2 research endpoints — Firecrawl's **research paper index**
|
|
265
|
+
* (~43M paper abstracts) plus GitHub history/readmes.
|
|
266
|
+
*
|
|
267
|
+
* The paper corpus is roughly 90% biomedical and life sciences — PubMed,
|
|
268
|
+
* bioRxiv and medRxiv — with arXiv covering physics, mathematics and
|
|
269
|
+
* computer science.
|
|
270
|
+
*
|
|
271
|
+
* ⚠️ Not the same as `search({ categories: ["research"] })`, which is only a
|
|
272
|
+
* website/domain filter over ordinary web search (~14 academic domains,
|
|
273
|
+
* returning page snippets). Use `research.searchPapers()` for literature
|
|
274
|
+
* search.
|
|
275
|
+
*
|
|
276
|
+
* Example: `firecrawl.research.searchPapers("GLP-1 receptor agonists cardiovascular outcomes")`.
|
|
266
277
|
*/
|
|
267
278
|
get research(): ResearchClient {
|
|
268
279
|
if (!this._research) this._research = new ResearchClient(this.http);
|
|
@@ -63,16 +63,47 @@ function normalizeResearchError(err: any, action: string): never {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* Client for the v2 research endpoints
|
|
66
|
+
* Client for the v2 research endpoints — Firecrawl's **research paper index**
|
|
67
|
+
* (~43M paper abstracts) plus GitHub history/readmes.
|
|
68
|
+
*
|
|
69
|
+
* The paper corpus is roughly 90% biomedical and life sciences — PubMed,
|
|
70
|
+
* bioRxiv and medRxiv — with arXiv covering physics, mathematics and computer
|
|
71
|
+
* science. Supports abstract search, paper metadata, in-body passage reads and
|
|
72
|
+
* citation-graph expansion.
|
|
73
|
+
*
|
|
74
|
+
* ⚠️ This is **not** the same as `search({ categories: ["research"] })`. That
|
|
75
|
+
* option is a website/domain filter on ordinary web search: it narrows
|
|
76
|
+
* Google-style results to ~14 academic domains and returns page snippets. The
|
|
77
|
+
* methods here query the paper index itself and return ranked paper records.
|
|
78
|
+
*
|
|
67
79
|
* Accessed via `firecrawl.research`.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* const res = await firecrawl.research.searchPapers(
|
|
84
|
+
* "tau aggregation inhibitors in Alzheimer's disease",
|
|
85
|
+
* { k: 10 },
|
|
86
|
+
* );
|
|
87
|
+
* ```
|
|
68
88
|
*/
|
|
69
89
|
export class ResearchClient {
|
|
70
90
|
constructor(private readonly http: HttpClient) {}
|
|
71
91
|
|
|
72
92
|
/**
|
|
73
|
-
* Search
|
|
74
|
-
*
|
|
75
|
-
*
|
|
93
|
+
* Search the research paper index by abstract relevance.
|
|
94
|
+
*
|
|
95
|
+
* Queries ~43M paper abstracts: PubMed, bioRxiv and medRxiv (about 90% of the
|
|
96
|
+
* corpus — biomedical and life sciences) plus arXiv (physics, mathematics,
|
|
97
|
+
* computer science). Semantic search over abstracts, not keyword matching.
|
|
98
|
+
*
|
|
99
|
+
* This is **not** `search({ categories: ["research"] })`, which only narrows
|
|
100
|
+
* ordinary web search to ~14 academic websites.
|
|
101
|
+
*
|
|
102
|
+
* @param query Natural-language search query, e.g. `"CRISPR base editing
|
|
103
|
+
* off-target effects in primary human T cells"`.
|
|
104
|
+
* @param options Optional filters (k, authors, categories, from, to). Note
|
|
105
|
+
* `categories` here filters *paper* subject categories (e.g. `"q-bio.GN"`)
|
|
106
|
+
* and is unrelated to the `categories` option of `search()`.
|
|
76
107
|
*/
|
|
77
108
|
async searchPapers(
|
|
78
109
|
query: string,
|
|
@@ -102,8 +133,9 @@ export class ResearchClient {
|
|
|
102
133
|
/**
|
|
103
134
|
* Get paper metadata (detail mode), or read in-body passages (when `query` is
|
|
104
135
|
* supplied). `k` is only valid together with `query`.
|
|
105
|
-
* @param id Paper reference: a canonical `
|
|
106
|
-
*
|
|
136
|
+
* @param id Paper reference: a canonical `paperId`, or a namespaced id key
|
|
137
|
+
* such as `pmid:<id>`, `pmcid:<id>`, `doi:<doi>` or `arxiv:<id>`. Bare
|
|
138
|
+
* arXiv ids and arXiv URLs are also accepted.
|
|
107
139
|
* @param options Optional `query` (switches to read mode) and `k`.
|
|
108
140
|
*/
|
|
109
141
|
async getPaper(
|
package/src/v2/types.ts
CHANGED
|
@@ -207,6 +207,10 @@ export interface ScrapeOptions {
|
|
|
207
207
|
useMock?: string;
|
|
208
208
|
blockAds?: boolean;
|
|
209
209
|
proxy?: "basic" | "stealth" | "enhanced" | "auto" | string;
|
|
210
|
+
/**
|
|
211
|
+
* Maximum age, in milliseconds, of indexed content that may be reused.
|
|
212
|
+
* Set to `0` to bypass index reuse.
|
|
213
|
+
*/
|
|
210
214
|
maxAge?: number;
|
|
211
215
|
minAge?: number;
|
|
212
216
|
storeInCache?: boolean;
|
|
@@ -558,6 +562,7 @@ export interface DocumentMetadata {
|
|
|
558
562
|
// Common metadata fields
|
|
559
563
|
title?: string;
|
|
560
564
|
description?: string;
|
|
565
|
+
/** URL reported by the selected scrape engine. */
|
|
561
566
|
url?: string;
|
|
562
567
|
language?: string;
|
|
563
568
|
keywords?: string | string[];
|
|
@@ -594,7 +599,9 @@ export interface DocumentMetadata {
|
|
|
594
599
|
articleSection?: string;
|
|
595
600
|
|
|
596
601
|
// Response-level metadata
|
|
602
|
+
/** URL requested for the scrape. */
|
|
597
603
|
sourceURL?: string;
|
|
604
|
+
/** HTTP status code reported for the scrape response. */
|
|
598
605
|
statusCode?: number;
|
|
599
606
|
scrapeId?: string;
|
|
600
607
|
numPages?: number;
|
|
@@ -687,6 +694,28 @@ export interface SearchData {
|
|
|
687
694
|
developer?: Array<SearchResultWeb | Document>;
|
|
688
695
|
}
|
|
689
696
|
|
|
697
|
+
/**
|
|
698
|
+
* Narrows ordinary **web search**. A category does not switch `search()` to a
|
|
699
|
+
* different index.
|
|
700
|
+
*
|
|
701
|
+
* - `github` — restrict web results to github.com (a `site:` filter).
|
|
702
|
+
* - `research` — restrict web results to a fixed list of ~14 academic
|
|
703
|
+
* *websites* (arxiv.org, pubmed.ncbi.nlm.nih.gov, nature.com, science.org,
|
|
704
|
+
* ieee.org, sciencedirect.com, biorxiv.org, medrxiv.org, ...). It returns
|
|
705
|
+
* ordinary web page results from those domains, **not** paper records.
|
|
706
|
+
* - `pdf` — restrict results to PDFs (adds `filetype:pdf`).
|
|
707
|
+
* - `developer` — add developer results (issues, pull requests, READMEs and
|
|
708
|
+
* documentation) under `.developer`.
|
|
709
|
+
*
|
|
710
|
+
* ⚠️ `categories: ["research"]` is **not** Firecrawl's research paper index.
|
|
711
|
+
* To search papers themselves — ~43M abstracts, roughly 90% biomedical
|
|
712
|
+
* (PubMed, bioRxiv, medRxiv) plus arXiv — with full abstracts, in-body passage
|
|
713
|
+
* reads and citation-graph expansion, use `firecrawl.research.searchPapers()`
|
|
714
|
+
* (plus `getPaper()` and `similarPapers()`), which call `/v2/search/research`.
|
|
715
|
+
*
|
|
716
|
+
* Rule of thumb: literature search → `research.searchPapers()`; web pages that
|
|
717
|
+
* happen to live on academic domains → `search({ categories: ["research"] })`.
|
|
718
|
+
*/
|
|
690
719
|
export interface CategoryOption {
|
|
691
720
|
type: "github" | "research" | "pdf" | "developer";
|
|
692
721
|
}
|
|
@@ -696,6 +725,14 @@ export interface SearchRequest {
|
|
|
696
725
|
sources?: Array<
|
|
697
726
|
"web" | "news" | "images" | { type: "web" | "news" | "images" }
|
|
698
727
|
>;
|
|
728
|
+
/**
|
|
729
|
+
* Narrow web search by category. See {@link CategoryOption}.
|
|
730
|
+
*
|
|
731
|
+
* ⚠️ `"research"` is a website/domain filter over ordinary web search (~14
|
|
732
|
+
* academic domains), **not** the research paper index. For literature search
|
|
733
|
+
* over ~43M paper abstracts (PubMed / bioRxiv / medRxiv / arXiv) use
|
|
734
|
+
* `firecrawl.research.searchPapers()` instead.
|
|
735
|
+
*/
|
|
699
736
|
categories?: Array<
|
|
700
737
|
"github" | "research" | "pdf" | "developer" | CategoryOption
|
|
701
738
|
>;
|
|
@@ -1355,8 +1392,20 @@ export interface BrowserListResponse {
|
|
|
1355
1392
|
// ---------- Research (v2) ----------
|
|
1356
1393
|
|
|
1357
1394
|
/**
|
|
1358
|
-
* Source identifiers grouped by namespace.
|
|
1359
|
-
*
|
|
1395
|
+
* Source identifiers grouped by namespace. Each key is a namespace and each
|
|
1396
|
+
* value is an array of ids in that namespace.
|
|
1397
|
+
*
|
|
1398
|
+
* Which namespaces appear depends on the paper's source. Biomedical records
|
|
1399
|
+
* (PubMed, bioRxiv, medRxiv) typically carry `pmid`, `pmcid` and/or `doi`;
|
|
1400
|
+
* arXiv records carry `arxiv`. The set is open — treat this as a lookup by
|
|
1401
|
+
* namespace rather than a fixed schema, and prefer {@link PaperResult.primaryId}
|
|
1402
|
+
* when you just need one citable identifier.
|
|
1403
|
+
*
|
|
1404
|
+
* @example
|
|
1405
|
+
* ```ts
|
|
1406
|
+
* const doi = paper.ids?.doi?.[0];
|
|
1407
|
+
* const pmid = paper.ids?.pmid?.[0];
|
|
1408
|
+
* ```
|
|
1360
1409
|
*/
|
|
1361
1410
|
export type IdMap = Record<string, string[]>;
|
|
1362
1411
|
|
|
@@ -1372,7 +1421,7 @@ export interface PaperSignals {
|
|
|
1372
1421
|
seedOverlap: number;
|
|
1373
1422
|
}
|
|
1374
1423
|
|
|
1375
|
-
/** A ranked paper. `paperId` is canonical;
|
|
1424
|
+
/** A ranked paper. `paperId` is canonical; source ids (pmid, pmcid, doi, arxiv, ...) live in `ids`. */
|
|
1376
1425
|
export interface PaperResult {
|
|
1377
1426
|
/** Canonical paper id — the Milvus INT64 primary key as a decimal string. */
|
|
1378
1427
|
paperId: string;
|
|
@@ -1452,7 +1501,7 @@ export interface GitHubScoreBreakdown {
|
|
|
1452
1501
|
}
|
|
1453
1502
|
|
|
1454
1503
|
export interface GitHubSearchItem {
|
|
1455
|
-
resultType
|
|
1504
|
+
resultType?: "github_history" | "repo_readme" | "web";
|
|
1456
1505
|
/** `owner/name`; empty for web results whose URL is not a repo page. */
|
|
1457
1506
|
repo: string;
|
|
1458
1507
|
url: string;
|