firecrawl-scraper について
firecrawl-scraper は、Firecrawl のエンドポイントを選んで呼び出すスキルです。ページやサイトのコンテンツ抽出、URL の発見、複数ページの処理に使えます。
主な機能
- 01複数形式でのページ取得
- 02深度とパスを指定したサイト巡回
- 03サイト URL の検出
- 04複数 URL の並列取得
- 05ブラウザー操作によるページ制御
- 06巡回ジョブの状態確認
活用シーン
- 01ページから Markdown や HTML を抽出
- 02サイト内の URL を収集
- 03指定したドキュメントパスを巡回
- 04複数ページから構造化データを抽出
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ benedictking/ firecrawl-scraper --skill firecrawl-scraperインストール後、Claude Code で/firecrawl-scraperを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
.env.example.gitignorefirecrawl-api.cjsfirecrawl-fetcher.md詳細
Firecrawl スクレイパースキル
トリガー条件とエンドポイントの選択
ユーザーの意図に基づいて Firecrawl のエンドポイントを選択します。
- scrape:単一の Web ページからコンテンツ(markdown、html、json、スクリーンショット、PDF)を抽出する必要がある場合
- crawl:深さの制御やパスのフィルタリングを行いながら、Web サイト全体をクロールする必要がある場合
- map:Web サイト上のすべての URL の一覧をすばやく取得する必要がある場合
- batch-scrape:複数の URL を並列でスクレイピングする必要がある場合
- crawl-status:クロールジョブ ID を指定して、クロールの進行状況や結果を確認する場合(
--waitは任意)
推奨アーキテクチャ(メインスキル + サブスキル)
このスキルでは、次の 2 段階のアーキテクチャを使用します。
- メインスキル(現在のコンテキスト):ユーザーの質問を理解する → エンドポイントを選択する → JSON ペイロードを組み立てる
- サブスキル(フォークされたコンテキスト):HTTP 呼び出しの実行のみを担当し、会話履歴によるトークンの浪費を避ける
実行方法
Task ツールを使って firecrawl-fetcher サブスキルを呼び出し、コマンドと JSON(stdin)を渡します。
Task parameters:
- subagent_type: Bash
- description: "Call Firecrawl API"
- prompt: cat <<'JSON' | node .claude/skills/firecrawl-scraper/firecrawl-api.cjs <scrape|crawl|map|batch-scrape|crawl-status> [--wait]
{ ...payload... }
JSON
ペイロードの例
1) 単一ページのスクレイピング
cat <<'JSON' | node .claude/skills/firecrawl-scraper/firecrawl-api.cjs scrape
{
"url": "https://example.com",
"formats": ["markdown", "links"],
"onlyMainContent": true,
"includeTags": [],
"excludeTags": ["nav", "footer"],
"waitFor": 0,
"timeout": 30000
}
JSON
利用可能な形式:
"markdown"、"html"、"rawHtml"、"links"、"images"、"summary"{"type": "json", "prompt": "Extract product info", "schema": {...}}{"type": "screenshot", "fullPage": true, "quality": 85}
2) アクションを使ったスクレイピング(ページ操作)
cat <<'JSON' | node .claude/skills/firecrawl-scraper/firecrawl-api.cjs scrape
{
"url": "https://example.com",
"formats": ["markdown"],
"actions": [
{"type": "wait", "milliseconds": 2000},
{"type": "click", "selector": "#load-more"},
{"type": "wait", "milliseconds": 1000},
{"type": "scroll", "direction": "down", "amount": 500}
]
}
JSON
利用可能なアクション:
wait、click、write、press、scroll、screenshot、scrape、executeJavascript
3) PDF の解析
cat <<'JSON' | node .claude/skills/firecrawl-scraper/firecrawl-api.cjs scrape
{
"url": "https://example.com/document.pdf",
"formats": ["markdown"],
"parsers": ["pdf"]
}
JSON
4) 構造化 JSON の抽出
cat <<'JSON' | node .claude/skills/firecrawl-scraper/firecrawl-api.cjs scrape
{
"url": "https://example.com/product",
"formats": [
{
"type": "json",
"prompt": "Extract product information",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"price": {"type": "number"},
"description": {"type": "string"}
},
"required": ["name", "price"]
}
}
]
}
JSON
5) Web サイト全体のクロール
cat <<'JSON' | node .claude/skills/firecrawl-scraper/firecrawl-api.cjs crawl
{
"url": "https://docs.example.com",
"formats": ["markdown"],
"includePaths": ["^/docs/.*"],
"excludePaths": ["^/blog/.*"],
"maxDiscoveryDepth": 3,
"limit": 100,
"allowExternalLinks": false,
"allowSubdomains": false
}
JSON
5.1) クロールの完了を待機
cat <<'JSON' | node .claude/skills/firecrawl-scraper/firecrawl-api.cjs crawl --wait
{
"url": "https://docs.example.com",
"formats": ["markdown"],
"limit": 100
}
JSON
6) Web サイトの URL のマッピング
cat <<'JSON' | node .claude/skills/firecrawl-scraper/firecrawl-api.cjs map
{
"url": "https://example.com",
"search": "documentation",
"limit": 5000
}
JSON
7) 複数 URL の一括スクレイピング
cat <<'JSON' | node .claude/skills/firecrawl-scraper/firecrawl-api.cjs batch-scrape
{
"urls": [
"https://example.com/page1",
"https://example.com/page2",
"https://example.com/page3"
],
"formats": ["markdown"]
}
JSON
8) クロールステータスの確認
node .claude/skills/firecrawl-scraper/firecrawl-api.cjs crawl-status <crawl-id>
完了を待機:
node .claude/skills/firecrawl-scraper/firecrawl-api.cjs crawl-status <crawl-id> --wait
主な機能
形式
- markdown:整形された markdown コンテンツ
- html:解析済み HTML
- rawHtml:元の HTML
- links:ページ上のすべてのリンク
- images:ページ上のすべての画像
- summary:AI が生成した要約
- json:スキーマに基づく構造化データの抽出
- screenshot:ページのスクリーンショット(PNG)
コンテンツの制御
onlyMainContent:メインコンテンツのみを抽出します(デフォルト:true)includeTags:含める CSS セレクターexcludeTags:除外する CSS セレクターwaitFor:スクレイピング前の待機時間(ms)maxAge:キャッシュの有効期間(デフォルト:48 hours)
アクション(ブラウザーの自動化)
wait:指定した時間だけ待機しますclick:セレクターで指定した要素をクリックしますwrite:フィールドにテキストを入力しますpress:キーボードのキーを押しますscroll:ページをスクロールしますexecuteJavascript:カスタム JS を実行します
クロールオプション
includePaths:含める正規表現パターンexcludePaths:除外する正規表現パターンmaxDiscoveryDepth:クロールの最大深度limit:クロールするページの最大数allowExternalLinks:外部リンクをたどりますallowSubdomains:サブドメインをたどります
環境変数と API キー
API キーの設定方法は 2 つあります(優先順位:環境変数 > .env)。
- 環境変数:
FIRECRAWL_API_KEY .envファイル:.claude/skills/firecrawl-scraper/.envに配置します。.env.exampleからコピーできます
レスポンス形式
すべてのエンドポイントは、次の項目を含む JSON を返します。
success:成功したかどうかを示すブール値data:抽出されたコンテンツ(形式はエンドポイントによって異なります)- crawl の場合:ジョブ ID を返します。ステータスを確認するには
crawl-status(または GET /v2/crawl/{id})を使用します
コメント
Markdown 対応