搜索并按需抓取搜索结果
curl --request POST \
--url https://api.firecrawl.dev/v1/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"ignoreInvalidURLs": false,
"limit": 5,
"location": "<string>",
"scrapeOptions": {},
"tbs": "<string>",
"threatProtection": {
"blacklist": [
"<string>"
],
"blockedTlds": [
"<string>"
],
"riskScoreThreshold": 75,
"whitelist": [
"<string>"
]
},
"timeout": 60000
}
'import requests
url = "https://api.firecrawl.dev/v1/search"
payload = {
"query": "<string>",
"ignoreInvalidURLs": False,
"limit": 5,
"location": "<string>",
"scrapeOptions": {},
"tbs": "<string>",
"threatProtection": {
"blacklist": ["<string>"],
"blockedTlds": ["<string>"],
"riskScoreThreshold": 75,
"whitelist": ["<string>"]
},
"timeout": 60000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
ignoreInvalidURLs: false,
limit: 5,
location: '<string>',
scrapeOptions: {},
tbs: '<string>',
threatProtection: {
blacklist: ['<string>'],
blockedTlds: ['<string>'],
riskScoreThreshold: 75,
whitelist: ['<string>']
},
timeout: 60000
})
};
fetch('https://api.firecrawl.dev/v1/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.firecrawl.dev/v1/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '<string>',
'ignoreInvalidURLs' => false,
'limit' => 5,
'location' => '<string>',
'scrapeOptions' => [
],
'tbs' => '<string>',
'threatProtection' => [
'blacklist' => [
'<string>'
],
'blockedTlds' => [
'<string>'
],
'riskScoreThreshold' => 75,
'whitelist' => [
'<string>'
]
],
'timeout' => 60000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.firecrawl.dev/v1/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"ignoreInvalidURLs\": false,\n \"limit\": 5,\n \"location\": \"<string>\",\n \"scrapeOptions\": {},\n \"tbs\": \"<string>\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"timeout\": 60000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.firecrawl.dev/v1/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"ignoreInvalidURLs\": false,\n \"limit\": 5,\n \"location\": \"<string>\",\n \"scrapeOptions\": {},\n \"tbs\": \"<string>\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"timeout\": 60000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v1/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"ignoreInvalidURLs\": false,\n \"limit\": 5,\n \"location\": \"<string>\",\n \"scrapeOptions\": {},\n \"tbs\": \"<string>\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"timeout\": 60000\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"description": "<string>",
"html": "<string>",
"links": [
"<string>"
],
"markdown": "<string>",
"metadata": {
"description": "<string>",
"error": "<string>",
"numPages": 123,
"sourceURL": "<string>",
"statusCode": 123,
"title": "<string>",
"totalPages": 123
},
"rawHtml": "<string>",
"screenshot": "<string>",
"title": "<string>",
"url": "<string>"
}
],
"id": "<string>",
"success": true,
"warning": "<string>"
}{
"error": "Request timed out",
"success": false
}{
"error": "An unexpected error occurred on the server.",
"success": false
}搜索端点
Search
POST
/
search
搜索并按需抓取搜索结果
curl --request POST \
--url https://api.firecrawl.dev/v1/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"ignoreInvalidURLs": false,
"limit": 5,
"location": "<string>",
"scrapeOptions": {},
"tbs": "<string>",
"threatProtection": {
"blacklist": [
"<string>"
],
"blockedTlds": [
"<string>"
],
"riskScoreThreshold": 75,
"whitelist": [
"<string>"
]
},
"timeout": 60000
}
'import requests
url = "https://api.firecrawl.dev/v1/search"
payload = {
"query": "<string>",
"ignoreInvalidURLs": False,
"limit": 5,
"location": "<string>",
"scrapeOptions": {},
"tbs": "<string>",
"threatProtection": {
"blacklist": ["<string>"],
"blockedTlds": ["<string>"],
"riskScoreThreshold": 75,
"whitelist": ["<string>"]
},
"timeout": 60000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
ignoreInvalidURLs: false,
limit: 5,
location: '<string>',
scrapeOptions: {},
tbs: '<string>',
threatProtection: {
blacklist: ['<string>'],
blockedTlds: ['<string>'],
riskScoreThreshold: 75,
whitelist: ['<string>']
},
timeout: 60000
})
};
fetch('https://api.firecrawl.dev/v1/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.firecrawl.dev/v1/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '<string>',
'ignoreInvalidURLs' => false,
'limit' => 5,
'location' => '<string>',
'scrapeOptions' => [
],
'tbs' => '<string>',
'threatProtection' => [
'blacklist' => [
'<string>'
],
'blockedTlds' => [
'<string>'
],
'riskScoreThreshold' => 75,
'whitelist' => [
'<string>'
]
],
'timeout' => 60000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.firecrawl.dev/v1/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"ignoreInvalidURLs\": false,\n \"limit\": 5,\n \"location\": \"<string>\",\n \"scrapeOptions\": {},\n \"tbs\": \"<string>\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"timeout\": 60000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.firecrawl.dev/v1/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"ignoreInvalidURLs\": false,\n \"limit\": 5,\n \"location\": \"<string>\",\n \"scrapeOptions\": {},\n \"tbs\": \"<string>\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"timeout\": 60000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v1/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"ignoreInvalidURLs\": false,\n \"limit\": 5,\n \"location\": \"<string>\",\n \"scrapeOptions\": {},\n \"tbs\": \"<string>\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"timeout\": 60000\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"description": "<string>",
"html": "<string>",
"links": [
"<string>"
],
"markdown": "<string>",
"metadata": {
"description": "<string>",
"error": "<string>",
"numPages": 123,
"sourceURL": "<string>",
"statusCode": 123,
"title": "<string>",
"totalPages": 123
},
"rawHtml": "<string>",
"screenshot": "<string>",
"title": "<string>",
"url": "<string>"
}
],
"id": "<string>",
"success": true,
"warning": "<string>"
}{
"error": "Request timed out",
"success": false
}{
"error": "An unexpected error occurred on the server.",
"success": false
}注意:现已推出该 API 的全新 v2 版本,功能与性能均有升级。该 /search 端点将网页搜索与 Firecrawl 的抓取能力相结合,可为任意查询返回完整页面内容。 在请求中包含
scrapeOptions 并设置 formats: ["markdown"],即可为每个搜索结果获取完整的 markdown 内容;否则将默认仅返回结果 (url、title、description) 。
支持的查询运算符
| 运算符 | 功能 | 示例 |
|---|---|---|
"" | 对一段文本进行精确匹配 | "Firecrawl" |
- | 排除特定关键词或对其他运算符取反 | -bad, -site:firecrawl.dev |
site: | 仅返回来自指定网站的结果 | site:firecrawl.dev |
inurl: | 仅返回在 URL 中包含某个词的结果 | inurl:firecrawl |
allinurl: | 仅返回在 URL 中包含多个词的结果 | allinurl:git firecrawl |
intitle: | 仅返回在页面标题中包含某个词的结果 | intitle:Firecrawl |
allintitle: | 仅返回在页面标题中包含多个词的结果 | allintitle:firecrawl playground |
related: | 仅返回与特定域名相关的结果 | related:firecrawl.dev |
Location 参数
location 参数获取按地理位置定向的搜索结果。格式:“string”。示例:“Germany”、“San Francisco,California,United States”。
请参阅完整的支持位置列表,了解所有可用的国家和语言。
基于时间的搜索
tbs 参数按时间范围筛选结果,支持自定义日期区间。详见搜索功能文档,其中包含详细示例和支持的 formats。授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json
搜索查询
会从搜索结果中排除对其他 Firecrawl 端点无效的 URL。这样当你将搜索结果数据传递到其他 Firecrawl API 端点时,可以减少出错。
返回的最大结果数
必填范围:
1 <= x <= 100搜索结果的 location 参数
搜索结果抓取选项
Show child attributes
Show child attributes
基于时间的搜索参数。支持预定义时间范围(qdr:h、qdr:d、qdr:w、qdr:m、qdr:y)以及自定义日期范围(cdr:1,cd_min:MM/DD/YYYY,cd_max:MM/DD/YYYY)。
超时时间(毫秒)
⌘I

