> ## 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

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

<div id="prerequisites">
  ## 前提条件
</div>

* Node.js 18+
* Firecrawl APIキー — [無料で取得する](https://www.firecrawl.dev/app/api-keys)

<div id="install-the-sdk">
  ## SDKをインストール
</div>

```bash theme={null}
npm install firecrawl
```

<div id="environment-variable">
  ## 環境変数
</div>

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

```bash theme={null}
export FIRECRAWL_API_KEY=fc-YOUR-API-KEY
```

```javascript theme={null}
const app = new Firecrawl();
```

<div id="search-the-web">
  ## ウェブをSearch
</div>

```javascript theme={null}
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);
}
```

<div id="scrape-a-page">
  ## ページのスクレイピング
</div>

```javascript theme={null}
const result = await app.scrape("https://example.com");

console.log(result.markdown);
```

<Accordion title="レスポンス例">
  ```json theme={null}
  {
    "markdown": "# Example Domain\n\nThis domain is for use in illustrative examples...",
    "metadata": {
      "title": "Example Domain",
      "sourceURL": "https://example.com"
    }
  }
  ```
</Accordion>

<div id="interact-with-a-page">
  ## ページを Interact で操作する
</div>

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

```javascript theme={null}
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);
```

<div id="next-steps">
  ## 次のステップ
</div>

<CardGroup cols={2}>
  <Card title="スクレイピング ドキュメント" icon="file-lines" href="/ja/features/scrape">
    フォーマット、アクション、プロキシなど、スクレイピングのオプションをすべて掲載
  </Card>

  <Card title="Search ドキュメント" icon="magnifying-glass" href="/ja/features/search">
    Web を検索してページ全体のコンテンツを取得
  </Card>

  <Card title="Interact ドキュメント" icon="hand-pointer" href="/ja/features/interact">
    クリックやフォーム入力を通じて、動的コンテンツを抽出
  </Card>

  <Card title="Node SDK リファレンス" icon="node" href="/ja/sdks/node">
    クロール、map、バッチスクレイピングなどを含む完全なSDKリファレンス
  </Card>
</CardGroup>
