Documentation Index
Fetch the complete documentation index at: https://docs.firecrawl.dev/llms.txt
Use this file to discover all available pages before exploring further.
- Node.js 18+、Bun、または Deno
- Firecrawl APIキー — 無料で取得できます
npm install hono @mendable/firecrawl-js
.env に API キーを追加します:
FIRECRAWL_API_KEY=fc-YOUR-API-KEY
import { Hono } from "hono";
import Firecrawl from "@mendable/firecrawl-js";
const app = new Hono();
const firecrawl = new Firecrawl({ apiKey: process.env.FIRECRAWL_API_KEY });
app.post("/search", async (c) => {
const { query } = await c.req.json();
const results = await firecrawl.search(query, { limit: 5 });
return c.json(results);
});
export default app;
app.post("/scrape", async (c) => {
const { url } = await c.req.json();
const result = await firecrawl.scrape(url);
return c.json(result);
});
Interact を使うと、ライブのブラウザセッションを操作して、ボタンのクリック、フォーム入力、動的コンテンツの抽出を行えます。
app.post("/interact", async (c) => {
const { url } = await c.req.json();
const result = await firecrawl.scrape(url, { formats: ['markdown'] });
const scrapeId = result.metadata?.scrapeId;
await firecrawl.interact(scrapeId, { prompt: 'Search for iPhone 16 Pro Max' });
const response = await firecrawl.interact(scrapeId, { prompt: 'Click on the first result and tell me the price' });
await firecrawl.stopInteraction(scrapeId);
return c.json({ output: response.output });
});
Hono は複数のランタイムで動作します。Cloudflare Workers では、環境バインディングから API キーを渡します。
import { Hono } from "hono";
import Firecrawl from "@mendable/firecrawl-js";
type Bindings = { FIRECRAWL_API_KEY: string };
const app = new Hono<{ Bindings: Bindings }>();
app.post("/search", async (c) => {
const firecrawl = new Firecrawl({ apiKey: c.env.FIRECRAWL_API_KEY });
const { query } = await c.req.json();
const results = await firecrawl.search(query, { limit: 5 });
return c.json(results);
});
export default app;
スクレイピングのドキュメント
フォーマット、アクション、プロキシを含むスクレイピングのオプション一覧
検索ドキュメント
Webを検索してページ全体のコンテンツを取得
Interact ドキュメント
クリックやフォーム入力で動的コンテンツを抽出
Node SDK リファレンス
クロール、map、バッチスクレイプなどを含むSDKの完全なリファレンス