Documentation Index Fetch the complete documentation index at: https://student-213fb9fc.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Firecrawlの検索APIを使うと、ウェブ検索を実行し、必要に応じて同一オペレーション内で検索結果をスクレイピングできます。
出力フォーマット(markdown、html、links、screenshot)を選択
位置情報などのパラメータを指定してウェブを検索
検索結果からコンテンツを任意で取得(各種フォーマット対応)
取得件数の制御やタイムアウトの設定が可能
詳細は、Search Endpoint API Reference を参照してください。
Playground で試す インタラクティブな Playground で検索を試してみましょう。コードは不要です。
ウェブ検索を実行し、必要に応じて結果からコンテンツを取得します。
# 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はペイロード全体を返します。
{
"success" : true ,
"data" : {
"web" : [
{
"url" : "https://www.firecrawl.dev/" ,
"title" : "Firecrawl - AI向けWebデータAPI" ,
"description" : "AI向けのウェブクローリング、スクレイピング、検索API。大規模運用に対応。Firecrawlはインターネット全体をAIエージェントやビルダーに提供します。" ,
"position" : 1
},
{
"url" : "https://github.com/firecrawl/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: 画像検索の結果
1 回の呼び出しで複数のソースを指定できます(例: sources: ["web", "news"])。この場合、limit パラメータはソースタイプごと に適用されます。そのため、limit: 5 かつ sources: ["web", "news"] の場合、最大 5 件の web 結果と最大 5 件の news 結果(合計 10 件)が返されます。ソースごとに異なるパラメータ(たとえば、異なる limit 値や異なる scrapeOptions)が必要な場合は、別々の呼び出しを行ってください。
categories パラメータを使って、特定のカテゴリで検索結果を絞り込みます:
github: GitHub のリポジトリ、コード、Issue、ドキュメントを検索
research: 学術・研究サイト(arXiv、Nature、IEEE、PubMed など)を検索
pdf: PDF を検索
GitHub のリポジトリ内を対象に絞り込んで検索します:
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 -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 -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 -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 -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
}'
高解像度の画像を見つけるには、画像検索の演算子を使います:
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 -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" )
# 検索してコンテンツを取得する
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\n Firecrawl は、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_result = firecrawl.search(
"web scraping tools" ,
limit = 5 ,
location = "Germany"
)
# 結果を処理
for result in search_result.data:
print ( f "タイトル: { result[ 'title' ] } " )
print ( f "URL: { result[ 'url' ] } " )
tbs パラメータを使って、結果を時間範囲でフィルタリングします。tbs は web ソースの結果にのみ適用され、news や images の結果には適用されない点に注意してください。時間で絞り込んだニュース結果が必要な場合は、特定のニュースドメインを対象にするために、site: 演算子と組み合わせた web ソースの利用を検討してください。
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年
sbd: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"
)
sbd:1 を時間フィルタと組み合わせることで、指定した期間内の結果を日付順にソートして取得できます。たとえば、sbd:1,qdr:w は過去1週間の結果を新しい順で返し、sbd:1,cdr:1,cd_min:12/1/2024,cd_max:12/31/2024 は2024年12月の結果を日付順に返します。
検索処理のタイムアウトを任意に設定します:
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回あたりのコストは、検索結果10件ごとに2クレジットです。スクレイピングオプションを有効にすると、各検索結果に対して標準のスクレイピングコストが適用されます:
Basic scrape : ウェブページ1枚あたり1クレジット
PDF parsing : PDFページ1枚あたり1クレジット
Enhanced proxy mode : ウェブページ1枚あたり追加で4クレジット
JSON mode : ウェブページ1枚あたり追加で4クレジット
コストを抑えるために:
PDF解析が不要な場合は parsers: [] を設定する
可能な場合は "enhanced" の代わりに proxy: "basic" を使用するか、"auto" に設定する
limit パラメータで検索結果数を制限する
スクレイピングオプションの詳細は、Scrape 機能のドキュメント を参照してください。FIRE-1(エージェント)と changeTracking 機能を除き、この Search エンドポイントでサポートされています。