Skip to content
Firecrawl Docs
Firecrawl Docs
Node.js

Node.js

Node.js で Firecrawl を始めましょう。公式 SDK を使って、Web データのスクレイピング、検索、操作を行えます。

npm install firecrawl

apiKey を直接渡す代わりに、FIRECRAWL_API_KEY 環境変数を設定してください。

export FIRECRAWL_API_KEY=fc-YOUR-API-KEY
const app = new Firecrawl();
import { Firecrawl } from 'firecrawl';

const app = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });
const results = await app.search("firecrawl web scraping", { limit: 5 });

for (const result of results.web) {
  console.log(result.title, result.url);
}
const result = await app.scrape("https://example.com");

console.log(result.markdown);

Interact を使うと、実行中のブラウザセッションを操作して、ボタンのクリック、フォームへの入力、動的コンテンツの抽出を行えます。

const result = await app.scrape('https://www.amazon.com', { formats: ['markdown'] });
const scrapeId = result.metadata?.scrapeId;

await app.interact(scrapeId, { prompt: 'Search for iPhone 16 Pro Max' });
const response = await app.interact(scrapeId, { prompt: 'Click on the first result and tell me the price' });
console.log(response.output);

await app.stopInteraction(scrapeId);
Was this page helpful?Suggest editsRaise issue