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.
Elixir 1.14+ と OTP 25+
Firecrawl APIキー — 無料で取得できます
mix.exs に firecrawl を追加します。
defp deps do
[
{ :firecrawl , "~> 1.0" }
]
end
config/config.exs でAPIキーを設定します:
config :firecrawl , api_key: System . get_env ( "FIRECRAWL_API_KEY" )
{ :ok , result} = Firecrawl . search_and_scrape ( query: "firecrawl web scraping" , limit: 5 )
for entry <- result.body[ "data" ][ "web" ] do
IO . puts ( " #{ entry[ "title" ] } - #{ entry[ "url" ] } " )
end
{ :ok , result} = Firecrawl . scrape_and_extract_from_url ( url: "https://example.com" )
IO . puts (result.body[ "data" ][ "markdown" ])
{
"success" : true ,
"data" : {
"markdown" : "# Example Domain \n\n This domain is for use in illustrative examples..." ,
"metadata" : {
"title" : "Example Domain" ,
"sourceURL" : "https://example.com"
}
}
}
ページをスクレイピングした後、ブラウザセッション API を使ってそのまま操作を続けます。
{ :ok , scrape} = Firecrawl . scrape_and_extract_from_url (
url: "https://www.amazon.com" ,
formats: [ "markdown" ]
)
scrape_id = get_in (scrape.body, [ "data" , "metadata" , "scrapeId" ])
# インタラクト用のREST APIを使用する(プロンプトベース)
headers = [
{ "Authorization" , "Bearer #{ Application . get_env ( :firecrawl , :api_key ) } " },
{ "Content-Type" , "application/json" }
]
{ :ok , _ } = Req . post (
"https://api.firecrawl.dev/v2/scrape/ #{ scrape_id } /interact" ,
json: %{ prompt: "Search for iPhone 16 Pro Max" },
headers: headers
)
{ :ok , response} = Req . post (
"https://api.firecrawl.dev/v2/scrape/ #{ scrape_id } /interact" ,
json: %{ prompt: "Click on the first result and tell me the price" },
headers: headers
)
IO . inspect (response.body)
# セッションを停止する
Req . delete (
"https://api.firecrawl.dev/v2/scrape/ #{ scrape_id } /interact" ,
headers: headers
)
ハードコードする代わりに、FIRECRAWL_API_KEY を環境変数として設定します:
export FIRECRAWL_API_KEY = fc-YOUR-API-KEY
スクレイピングのドキュメント フォーマット、アクション、プロキシを含むスクレイピングの全オプション
検索ドキュメント ウェブを検索し、ページ全体のコンテンツを取得
Interact ドキュメント クリック、フォーム入力、動的コンテンツの抽出
Elixir SDK リファレンス クロール、map、バッチスクレイプなどを含む SDK の完全なリファレンス