通过 Firecrawl API 为 AI 代理抓取、搜索、映射和爬取网页,适用于需要从 JS 重度或 SPA 站点获取干净 Markdown 的场景。
Firecrawl is a managed API for the three cases where a basic web_fetch agent tool falls short:
TaskRecommendedPlain HTML articleweb_fetch (free, fast)Quick searchbasic web search tool (free)JS-heavy / SPA pagefc scrapeSearch + full contentfc search --scrapeFull doc-site crawlfc crawlURL inventory of a sitefc mapPage needing clicks / loginfc interact (REST only, see below)
Rule of thumb: if web_fetch returns empty markup or noise, escalate to fc scrape.
bash
fc scrape https://example.com # markdown to stdout
fc scrape https://example.com --format html --out a.html
fc scrape https://example.com --out ~/scraped/page.md
bash
fc search "best running shoes 2026" --limit 5
fc search "topic" --limit 3 --scrape # include full content of each hit
fc search "..." --out results.json
bash
fc map https://docs.example.com --limit 200
fc map https://example.com --out urls.txt
bash
fc crawl https://docs.example.com --limit 50 --out ~/docs-mirror/
⚠️ Takes minutes. Each page = 1 credit. Don't blast it on a tight free-tier budget.
bash
fc ask "why did my scrape return empty?" --jobId abc123
fc docs "how do I bypass cloudflare?"
bash
fc status # prints key prefix + a smoke-test scrape
Before large crawl/ map calls with high --limit, warn the user about credit cost.
bash
# Try the free tool first.
# If it returns empty / unreadable:
fc scrape <url> --out /tmp/article.md
bash
fc search "<topic>" --limit 5 --scrape --out /tmp/research.json
# Then parse the JSON and pull what you need.
bash
fc map https://docs.example.com --limit 100 # get the URL list
# Pick relevant URLs and:
fc scrape <selected_urls>...
# Or in bulk:
fc crawl https://docs.example.com --limit 20 --out ~/mirror/
~/.openclaw/credentials/firecrawl/api_key ( chmod 600).https://api.firecrawl.dev/v2Authorization: Bearer fc-...~/bin/fc → your local fc.cjs (Node CommonJS, zero dependencies).Get a key at: https://firecrawl.dev (free tier available).
Example — interact (clicks / form-fill) which isn't wrapped in the CLI yet:
bash
KEY=$(cat ~/.openclaw/credentials/firecrawl/api_key)
curl -X POST https://api.firecrawl.dev/v2/scrape \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/login",
"formats": ["markdown"],
"actions": [
{"type": "wait", "milliseconds": 1000},
{"type": "click", "selector": "#login-button"},
{"type": "write", "selector": "#email", "text": "..."}
]
}'
Full docs: https://docs.firecrawl.dev
--limit — credits burn fast.web_fetch works — wasteful.