mcpField
F
firecrawl

firecrawl

github.com/tumfデータ・データベース4125 回インストール27 週間前に更新
リポジトリ

firecrawl について

Firecrawl を使い、Python スクリプトでウェブ検索、ページ取得、URL マッピング、クロール、構造化データ抽出を行うスキルです。調査やデータ収集に向けた機能を備えています。

主な機能

  1. 01Markdown または HTML でページ取得
  2. 02ウェブ検索と結果の取得
  3. 03サイト内 URL の発見
  4. 04深度を指定した関連ページのクロール
  5. 05プロンプトやスキーマによる構造化データ抽出
  6. 06自律エージェントによる情報収集

活用シーン

  1. 01指定ページの主要コンテンツの取得
  2. 02サイト内の関連ページの発見
  3. 03複数の関連ページからの情報収集
  4. 04ウェブページからの形式をそろえた項目抽出

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/tumf/skills --skill firecrawl

インストール後、Claude Code で/firecrawlを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

README.md
scripts/
agent.py
crawl.py
extract.py
map.py
scrape.py
search.py

詳細

Firecrawl によるウェブスクレイピングとデータ抽出

インストール

pip install firecrawl-py

環境設定

Firecrawl API キーを設定します:

export FIRECRAWL_API_KEY="your-api-key-here"

スクリプト

注:SKILL_ROOT をこのスキルのベースディレクトリに設定してください。同梱スクリプトは python3 "$SKILL_ROOT/scripts/<script>.py" ... の形式で参照してください(現在の作業ディレクトリからの相対パスは使用しないでください)。

scrape.py - 単一ページのスクレイピング

最も強力で信頼性の高いスクレイパーです。情報がどのページにあるか正確にわかっている場合に使用します。

# Basic scrape (returns markdown)
python3 "$SKILL_ROOT/scripts/scrape.py" "https://example.com"

# Get HTML format
python3 "$SKILL_ROOT/scripts/scrape.py" "https://example.com" --format html

# Extract only main content (removes headers, footers, etc.)
python3 "$SKILL_ROOT/scripts/scrape.py" "https://example.com" --only-main

# Combine options
python3 "$SKILL_ROOT/scripts/scrape.py" "https://docs.example.com/api" --format markdown --only-main
search.py - ウェブ検索

情報がどのウェブサイトにあるかわからない場合は、ウェブを検索します。

# Basic search
python3 "$SKILL_ROOT/scripts/search.py" "latest AI research papers 2024"

# Limit results
python3 "$SKILL_ROOT/scripts/search.py" "Python web scraping tutorials" --limit 5

# Search with scraping (get full content)
python3 "$SKILL_ROOT/scripts/search.py" "firecrawl documentation" --limit 3
map.py - URL の検出

ウェブサイト上のすべての URL を検出します。スクレイピングする内容を決める前に使用します。

# Map a website
python3 "$SKILL_ROOT/scripts/map.py" "https://docs.example.com"

# Limit number of URLs
python3 "$SKILL_ROOT/scripts/map.py" "https://example.com" --limit 100

# Search within mapped URLs
python3 "$SKILL_ROOT/scripts/map.py" "https://docs.example.com" --search "authentication"
crawl.py - 複数ページのクロール

関連する複数のページからコンテンツを抽出します。警告:時間がかかり、大量の結果が返されることがあります。

# Basic crawl
python3 "$SKILL_ROOT/scripts/crawl.py" "https://docs.example.com"

# Limit pages
python3 "$SKILL_ROOT/scripts/crawl.py" "https://docs.example.com" --limit 20

# Control crawl depth
python3 "$SKILL_ROOT/scripts/crawl.py" "https://docs.example.com" --limit 10 --depth 2
extract.py - 構造化データの抽出

LLM の機能を使って、特定の構造化データを抽出します。

# Extract with prompt
python3 "$SKILL_ROOT/scripts/extract.py" "https://example.com/pricing" \
  --prompt "Extract all pricing tiers with their features and prices"

# Extract with JSON schema
python3 "$SKILL_ROOT/scripts/extract.py" "https://example.com/team" \
  --prompt "Extract team member information" \
  --schema '{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"role":{"type":"string"},"bio":{"type":"string"}}}}}}'

# Extract from multiple URLs
python3 "$SKILL_ROOT/scripts/extract.py" "https://example.com/page1" "https://example.com/page2" \
  --prompt "Extract product information"
agent.py - 自律的なデータ収集

ウェブ上のあらゆる場所を検索、ナビゲートし、データを抽出する自律型エージェントです。

# Simple research task
python3 "$SKILL_ROOT/scripts/agent.py" --prompt "Find the founders of Firecrawl and their backgrounds"

# Complex data gathering
python3 "$SKILL_ROOT/scripts/agent.py" --prompt "Find the top 5 AI startups founded in 2024 and their funding amounts"

# Focus on specific URLs
python3 "$SKILL_ROOT/scripts/agent.py" \
  --prompt "Compare the features and pricing" \
  --urls "https://example1.com,https://example2.com"

# With output schema
python3 "$SKILL_ROOT/scripts/agent.py" \
  --prompt "Find recent tech layoffs" \
  --schema '{"type":"object","properties":{"layoffs":{"type":"array","items":{"type":"object","properties":{"company":{"type":"string"},"count":{"type":"number"},"date":{"type":"string"}}}}}}'

出力形式

すべてのスクリプトは JSON を標準出力に出力します。エラーは標準エラー出力に書き込まれます。

成功レスポンス
{
  "success": true,
  "data": { ... }
}
エラーレスポンス
{
  "success": false,
  "error": "Error message"
}

ヒント

  1. パフォーマンス:単一ページには scrape を使用します。キャッシュにより 500% 高速です
  2. 検出:最初に map で URL を見つけ、その後、特定のページを scrape します
  3. 大規模なサイト:より適切に制御するには、crawl よりも map と scrape の組み合わせを優先します
  4. 構造化データ:一貫した出力を得るには、JSON スキーマを指定して extract を使用します
  5. リサーチ:データの場所がわからない場合は agent を使用します

コメント