概述
关键改进
-
默认更快:请求会使用
maxAge
(默认 2 天)进行缓存,并启用合理的默认设置,如blockAds
、skipTlsVerification
和removeBase64Images
。 -
新的摘要格式:现在可以将
"summary"
指定为格式,直接获取页面内容的精炼摘要。 -
更新的 JSON 提取:JSON 提取和变更追踪现在使用对象格式:
{ type: "json", prompt, schema }
。旧的"extract"
格式已重命名为"json"
。 -
更强大的截图选项:使用对象形式:
{ type: "screenshot", fullPage, quality, viewport }
。 -
新的搜索来源:通过设置
sources
参数,除网页结果外,还可在"news"
和"images"
中进行搜索。 -
基于提示的智能爬取:传入自然语言
prompt
进行爬取,系统会自动推导路径/限制。开始任务前,可使用新的 /crawl/params-preview 端点检查推导出的选项。
快速迁移清单
- 将 v1 客户端用法替换为 v2 客户端:
- JS:
const firecrawl = new Firecrawl({ apiKey: 'fc-YOUR-API-KEY' })
- Python:
firecrawl = Firecrawl(api_key='fc-YOUR-API-KEY')
- API:改用新的
https://api.firecrawl.dev/v2/
端点。
- JS:
- 更新格式:
- 需要时使用 “summary”
- JSON 模式:进行 JSON 抽取时使用
{ type: "json", prompt, schema }
- Screenshot 和 Screenshot@fullPage:指定选项时使用 screenshot 对象格式
- 在 SDK 中采用标准化的异步流程:
- Crawls:
startCrawl
+getCrawlStatus
(或crawl
等待器) - Batch:
startBatchScrape
+getBatchScrapeStatus
(或batchScrape
等待器) - Extract:
startExtract
+getExtractStatus
(或extract
等待器)
- Crawls:
- 爬取选项映射(见下文)
- 使用
/crawl/params-preview
检查爬取的prompt
SDK 外观(v2)
JS/TS
方法名变更(v1 → v2)
v1(FirecrawlApp) | v2(Firecrawl) |
---|---|
scrapeUrl(url, ...) | scrape(url, options?) |
search(query, ...) | search(query, options?) |
mapUrl(url, ...) | map(url, options?) |
v1 | v2 |
---|---|
crawlUrl(url, ...) | crawl(url, options?) (waiter) |
asyncCrawlUrl(url, ...) | startCrawl(url, options?) |
checkCrawlStatus(id, ...) | getCrawlStatus(id) |
cancelCrawl(id) | cancelCrawl(id) |
checkCrawlErrors(id) | getCrawlErrors(id) |
v1 | v2 |
---|---|
batchScrapeUrls(urls, ...) | batchScrape(urls, opts?) (waiter) |
asyncBatchScrapeUrls(urls, ...) | startBatchScrape(urls, opts?) |
checkBatchScrapeStatus(id, ...) | getBatchScrapeStatus(id) |
checkBatchScrapeErrors(id) | getBatchScrapeErrors(id) |
v1 | v2 |
---|---|
extract(urls?, params?) | extract(args) |
asyncExtract(urls, params?) | startExtract(args) |
getExtractStatus(id) | getExtractStatus(id) |
v1 | v2 |
---|---|
generateLLMsText(...) | (v2 SDK 中无) |
checkGenerateLLMsTextStatus(id) | (v2 SDK 中无) |
crawlUrlAndWatch(...) | watcher(jobId, ...) |
batchScrapeUrlsAndWatch(...) | watcher(jobId, ...) |
Python(同步)
方法名变更(v1 → v2)
v1 | v2 |
---|---|
scrape_url(...) | scrape(...) |
search(...) | search(...) |
map_url(...) | map(...) |
v1 | v2 |
---|---|
crawl_url(...) | crawl(...) (waiter) |
async_crawl_url(...) | start_crawl(...) |
check_crawl_status(...) | get_crawl_status(...) |
cancel_crawl(...) | cancel_crawl(...) |
v1 | v2 |
---|---|
batch_scrape_urls(...) | batch_scrape(...) (waiter) |
async_batch_scrape_urls(...) | start_batch_scrape(...) |
get_batch_scrape_status(...) | get_batch_scrape_status(...) |
get_batch_scrape_errors(...) | get_batch_scrape_errors(...) |
v1 | v2 |
---|---|
extract(...) | extract(...) |
start_extract(...) | start_extract(...) |
get_extract_status(...) | get_extract_status(...) |
v1 | v2 |
---|---|
generate_llms_text(...) | (v2 SDK 中无) |
get_generate_llms_text_status(...) | (v2 SDK 中无) |
watch_crawl(...) | watcher(job_id, ...) |
Python(异步)
AsyncFirecrawl
提供相同的方法(均可 await)。
格式与抓取选项
- 基础用例使用字符串格式:“markdown”、“html”、“rawHtml”、“links”、“summary”。
- 将
parsePDF
改为使用parsers: [ { "type": "pdf" } | "pdf" ]
。 - 对于 JSON、变更追踪与截图,请使用对象格式:
JSON 格式
截图格式
爬取选项映射(v1 → v2)
v1 | v2 |
---|---|
allowBackwardCrawling | (已移除)请使用 crawlEntireDomain |
maxDepth | (已移除)请使用 maxDiscoveryDepth |
ignoreSitemap (bool) | sitemap (例如:“only”、“skip”或“include”) |
(none) | prompt |