Firecrawlの検索APIを使うと、ウェブ検索を実行し、必要に応じて同一オペレーション内で検索結果をスクレイピングできます。
  • 出力フォーマット(markdown、html、links、screenshot)を選択
  • 位置情報などのパラメータを指定してウェブを検索
  • 検索結果からコンテンツを任意で取得(各種フォーマット対応)
  • 取得件数の制御やタイムアウトの設定が可能
詳細は、Search Endpoint API Referenceを参照してください。

Firecrawl で検索を行う

/search エンドポイント

ウェブ検索を実行し、必要に応じて結果からコンテンツを取得します。

インストール

# pip install firecrawl-py

from firecrawl import Firecrawl

firecrawl = Firecrawl(api_key="fc-YOUR-API-KEY")

基本的な使い方

from firecrawl import Firecrawl

firecrawl = Firecrawl(api_key="fc-YOUR-API-KEY")

results = firecrawl.search(
    query="firecrawl",
    limit=3,
)
print(results)

レスポンス

SDKはデータオブジェクトを直接返します。cURLはペイロード全体を返します。
JSON
{
  "success": true,
  "data": {
    "web": [
      {
        "url": "https://www.firecrawl.dev/",
        "title": "Firecrawl - The Web Data API for AI",
        "description": "The web crawling, scraping, and search API for AI. Built for scale. Firecrawl delivers the entire internet to AI agents and builders.",
        "position": 1
      },
      {
        "url": "https://github.com/mendableai/firecrawl",
        "title": "mendableai/firecrawl: Turn entire websites into LLM-ready ... - GitHub",
        "description": "Firecrawl is an API service that takes a URL, crawls it, and converts it into clean markdown or structured data.",
        "position": 2
      },
      ...
    ],
    "images": [
      {
        "title": "Quickstart | Firecrawl",
        "imageUrl": "https://mintlify.s3.us-west-1.amazonaws.com/firecrawl/logo/logo.png",
        "imageWidth": 5814,
        "imageHeight": 1200,
        "url": "https://docs.firecrawl.dev/",
        "position": 1
      },
      ...
    ],
    "news": [
      {
        "title": "Y Combinator startup Firecrawl is ready to pay $1M to hire three AI agents as employees",
        "url": "https://techcrunch.com/2025/05/17/y-combinator-startup-firecrawl-is-ready-to-pay-1m-to-hire-three-ai-agents-as-employees/",
        "snippet": "It's now placed three new ads on YC's job board for “AI agents only” and has set aside a $1 million budget total to make it happen.",
        "date": "3 months ago",
        "position": 1
      },
      ...
    ]
  }
}

検索結果の種類

通常のウェブ結果に加え、Search は sources パラメータで以下の特化タイプを指定できます:
  • web: 標準的なウェブ結果(デフォルト)
  • news: ニュース特化の結果
  • images: 画像検索の結果

検索カテゴリ

categories パラメータで特定のカテゴリに絞り込めます:
  • github: GitHub のリポジトリ、コード、Issue、ドキュメントを検索
  • research: 学術・研究系サイト(arXiv、Nature、IEEE、PubMed など)を検索
GitHub のリポジトリ内を対象に絞り込んで検索します:
cURL
curl -X POST https://api.firecrawl.dev/v2/search \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer fc-YOUR_API_KEY" \
  -d '{
    "query": "web scraping python",
    "categories": ["github"],
    "limit": 10
  }'
学術・研究系のウェブサイトを検索します:
cURL
curl -X POST https://api.firecrawl.dev/v2/search \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer fc-YOUR_API_KEY" \
  -d '{
    "query": "機械学習 トランスフォーマー",
    "categories": ["研究"],
    "limit": 10
  }'
1回の検索で複数のカテゴリを組み合わせる:
cURL
curl -X POST https://api.firecrawl.dev/v2/search \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer fc-YOUR_API_KEY" \
  -d '{
    "query": "ニューラルネットワーク",
    "categories": ["github", "research"],
    "limit": 15
  }'

カテゴリのレスポンス形式

各検索結果には、出所を示す category フィールドが含まれます。
{
  "success": true,
  "data": {
    "web": [
      {
        "url": "https://github.com/example/neural-network",
        "title": "ニューラルネットワーク実装",
        "description": "PyTorch によるニューラルネットワークの実装",
        "category": "github"
      },
      {
        "url": "https://arxiv.org/abs/2024.12345",
        "title": "ニューラルネットワークアーキテクチャの進展",
        "description": "ニューラルネットワークの改良に関する研究論文"
        "category": "research"
      }
    ]
  }
}
例:
cURL
curl -X POST https://api.firecrawl.dev/v2/search \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer fc-YOUR_API_KEY" \
  -d '{
    "query": "openai",
    "sources": ["news"],
    "limit": 5
  }'
cURL
curl -X POST https://api.firecrawl.dev/v2/search \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer fc-YOUR_API_KEY" \
  -d '{
    "query": "jupiter",
    "sources": ["images"],
    "limit": 8
  }'

サイズフィルタ付きHD画像検索

高解像度の画像を見つけるには、Google画像検索の演算子を使います:
cURL
curl -X POST https://api.firecrawl.dev/v2/search \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer fc-YOUR_API_KEY" \
  -d '{
    "query": "sunset imagesize:1920x1080",
    "sources": ["images"],
    "limit": 5
  }'
cURL
curl -X POST https://api.firecrawl.dev/v2/search \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer fc-YOUR_API_KEY" \
  -d '{
    "query": "mountain wallpaper larger:2560x1440",
    "sources": ["images"],
    "limit": 8
  }'
一般的なHDの解像度:
  • imagesize:1920x1080 - フルHD(1080p)
  • imagesize:2560x1440 - QHD(1440p)
  • imagesize:3840x2160 - 4K UHD
  • larger:1920x1080 - HD以上
  • larger:2560x1440 - QHD以上

コンテンツのスクレイピング付き検索

1回の操作で検索し、検索結果からコンテンツを取得します。
from firecrawl import Firecrawl

firecrawl = Firecrawl(api_key="fc-YOUR_API_KEY")

# Search and scrape content
results = firecrawl.search(
    "firecrawl web scraping",
    limit=3,
    scrape_options={
        "formats": ["markdown", "links"]
    }
)
この /search エンドポイントは、scrapeOptions パラメータ経由で /scrape エンドポイントのすべてのオプションに対応しています。

スクレイプ済みコンテンツを含むレスポンス

{
  "success": true,
  "data": [
    {
      "title": "Firecrawl - 究極のWebスクレイピングAPI",
      "description": "Firecrawl は、あらゆるウェブサイトを AI や分析向けのクリーンで構造化されたデータに変換する強力なWebスクレイピングAPIです。",
      "url": "https://firecrawl.dev/",
      "markdown": "# Firecrawl\n\n究極のWebスクレイピングAPI\n\n## あらゆるウェブサイトをクリーンで構造化されたデータに変換\n\nFirecrawl は、AIアプリケーション、市場調査、コンテンツ集約などに向けて、ウェブサイトからデータを手軽に抽出できます...",
      "links": [
        "https://firecrawl.dev/pricing",
        "https://firecrawl.dev/docs",
        "https://firecrawl.dev/guides"
      ],
      "metadata": {
        "title": "Firecrawl - 究極のWebスクレイピングAPI",
        "description": "Firecrawl は、あらゆるウェブサイトを AI や分析向けのクリーンで構造化されたデータに変換する強力なWebスクレイピングAPIです。"
        "sourceURL": "https://firecrawl.dev/",
        "statusCode": 200
      }
    }
  ]
}

高度な検索オプション

Firecrawlの検索APIは、検索をカスタマイズできる各種パラメータに対応しています。

場所のカスタマイズ

from firecrawl import Firecrawl

firecrawl = Firecrawl(api_key="fc-YOUR_API_KEY")

# Search with location settings (Germany)
search_result = firecrawl.search(
    "web scraping tools",
    limit=5,
    location="Germany"
)

# Process the results
for result in search_result.data:
    print(f"Title: {result['title']}")
    print(f"URL: {result['url']}")
tbs パラメータを使って、結果を期間でフィルタします:
from firecrawl import Firecrawl

firecrawl = Firecrawl(api_key="fc-YOUR-API-KEY")

results = firecrawl.search(
    query="firecrawl",
    limit=5,
    tbs="qdr:d",
)
print(len(results.get('web', [])))
一般的な tbs の値:
  • qdr:h - 過去1時間
  • qdr:d - 過去24時間
  • qdr:w - 過去1週間
  • qdr:m - 過去1か月
  • qdr:y - 過去1年
より細かく絞り込みたい場合は、カスタム日付範囲フォーマットで日付範囲を指定できます:
from firecrawl import Firecrawl

# APIキーでクライアントを初期化
firecrawl = Firecrawl(api_key="fc-YOUR_API_KEY")

# 2024年12月の結果を検索
search_result = firecrawl.search(
    "firecrawl updates",
    limit=10,
    tbs="cdr:1,cd_min:12/1/2024,cd_max:12/31/2024"
)

カスタムタイムアウト

検索処理のタイムアウトを任意に設定します:
from firecrawl import FirecrawlApp

# APIキーでクライアントを初期化
app = FirecrawlApp(api_key="fc-YOUR_API_KEY")

# タイムアウトを30秒に設定
search_result = app.search(
    "complex search query",
    limit=10,
    timeout=30000  # ミリ秒単位で30秒
)

コストへの影響

このエンドポイントの利用コストは、検索結果1件あたり1クレジットです。各検索結果の基本的なスクレイピングに追加料金は発生しません。 ただし、次のコスト要因に注意してください:
  • PDF解析: PDF 1ページあたり1クレジット(複数ページのPDFではコストが大幅に増加する可能性があります)
  • ステルスプロキシモード: 検索結果1件あたり+4クレジット
  • JSONモード: 検索結果1件あたり+4クレジット
コストを抑えるには:
  • PDFコンテンツが不要な場合は parsers: [] を設定する
  • 可能な場合は "stealth" の代わりに proxy: "basic" を使用する
  • limit パラメータで検索結果数を制限する

高度なスクレイピングオプション

スクレイピングオプションの詳細は、Scrape 機能のドキュメントを参照してください。FIRE-1(エージェント)と changeTracking 機能を除き、この Search エンドポイントでサポートされています。