使用 Tavily Crawl、基于图的网站遍历工具。
curl --request POST \
--url https://api.aisa.one/apis/v1/tavily/crawl \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "docs.tavily.com",
"instructions": "<string>",
"chunks_per_source": 3,
"max_depth": 1,
"max_breadth": 20,
"limit": 50,
"select_paths": [
"<string>"
],
"select_domains": [
"<string>"
],
"exclude_paths": [
"<string>"
],
"exclude_domains": [
"<string>"
],
"allow_external": true,
"include_images": false,
"extract_depth": "basic",
"format": "markdown",
"include_favicon": false,
"timeout": 150,
"include_usage": false
}
'import requests
url = "https://api.aisa.one/apis/v1/tavily/crawl"
payload = {
"url": "docs.tavily.com",
"instructions": "<string>",
"chunks_per_source": 3,
"max_depth": 1,
"max_breadth": 20,
"limit": 50,
"select_paths": ["<string>"],
"select_domains": ["<string>"],
"exclude_paths": ["<string>"],
"exclude_domains": ["<string>"],
"allow_external": True,
"include_images": False,
"extract_depth": "basic",
"format": "markdown",
"include_favicon": False,
"timeout": 150,
"include_usage": False
}
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({
url: 'docs.tavily.com',
instructions: '<string>',
chunks_per_source: 3,
max_depth: 1,
max_breadth: 20,
limit: 50,
select_paths: ['<string>'],
select_domains: ['<string>'],
exclude_paths: ['<string>'],
exclude_domains: ['<string>'],
allow_external: true,
include_images: false,
extract_depth: 'basic',
format: 'markdown',
include_favicon: false,
timeout: 150,
include_usage: false
})
};
fetch('https://api.aisa.one/apis/v1/tavily/crawl', 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.aisa.one/apis/v1/tavily/crawl",
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([
'url' => 'docs.tavily.com',
'instructions' => '<string>',
'chunks_per_source' => 3,
'max_depth' => 1,
'max_breadth' => 20,
'limit' => 50,
'select_paths' => [
'<string>'
],
'select_domains' => [
'<string>'
],
'exclude_paths' => [
'<string>'
],
'exclude_domains' => [
'<string>'
],
'allow_external' => true,
'include_images' => false,
'extract_depth' => 'basic',
'format' => 'markdown',
'include_favicon' => false,
'timeout' => 150,
'include_usage' => false
]),
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.aisa.one/apis/v1/tavily/crawl"
payload := strings.NewReader("{\n \"url\": \"docs.tavily.com\",\n \"instructions\": \"<string>\",\n \"chunks_per_source\": 3,\n \"max_depth\": 1,\n \"max_breadth\": 20,\n \"limit\": 50,\n \"select_paths\": [\n \"<string>\"\n ],\n \"select_domains\": [\n \"<string>\"\n ],\n \"exclude_paths\": [\n \"<string>\"\n ],\n \"exclude_domains\": [\n \"<string>\"\n ],\n \"allow_external\": true,\n \"include_images\": false,\n \"extract_depth\": \"basic\",\n \"format\": \"markdown\",\n \"include_favicon\": false,\n \"timeout\": 150,\n \"include_usage\": false\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.aisa.one/apis/v1/tavily/crawl")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"docs.tavily.com\",\n \"instructions\": \"<string>\",\n \"chunks_per_source\": 3,\n \"max_depth\": 1,\n \"max_breadth\": 20,\n \"limit\": 50,\n \"select_paths\": [\n \"<string>\"\n ],\n \"select_domains\": [\n \"<string>\"\n ],\n \"exclude_paths\": [\n \"<string>\"\n ],\n \"exclude_domains\": [\n \"<string>\"\n ],\n \"allow_external\": true,\n \"include_images\": false,\n \"extract_depth\": \"basic\",\n \"format\": \"markdown\",\n \"include_favicon\": false,\n \"timeout\": 150,\n \"include_usage\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/tavily/crawl")
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 \"url\": \"docs.tavily.com\",\n \"instructions\": \"<string>\",\n \"chunks_per_source\": 3,\n \"max_depth\": 1,\n \"max_breadth\": 20,\n \"limit\": 50,\n \"select_paths\": [\n \"<string>\"\n ],\n \"select_domains\": [\n \"<string>\"\n ],\n \"exclude_paths\": [\n \"<string>\"\n ],\n \"exclude_domains\": [\n \"<string>\"\n ],\n \"allow_external\": true,\n \"include_images\": false,\n \"extract_depth\": \"basic\",\n \"format\": \"markdown\",\n \"include_favicon\": false,\n \"timeout\": 150,\n \"include_usage\": false\n}"
response = http.request(request)
puts response.read_body{
"base_url": "<string>",
"results": [
{
"url": "<string>",
"raw_content": "<string>",
"favicon": "<string>"
}
],
"response_time": 123,
"usage": {
"credits": 123
},
"request_id": "<string>"
}搜索 API
Tavily 抓取
使用 Tavily Crawl、基于图的网站遍历工具。
POST
https://api.aisa.one/apis/v1
/
tavily
/
crawl
使用 Tavily Crawl、基于图的网站遍历工具。
curl --request POST \
--url https://api.aisa.one/apis/v1/tavily/crawl \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "docs.tavily.com",
"instructions": "<string>",
"chunks_per_source": 3,
"max_depth": 1,
"max_breadth": 20,
"limit": 50,
"select_paths": [
"<string>"
],
"select_domains": [
"<string>"
],
"exclude_paths": [
"<string>"
],
"exclude_domains": [
"<string>"
],
"allow_external": true,
"include_images": false,
"extract_depth": "basic",
"format": "markdown",
"include_favicon": false,
"timeout": 150,
"include_usage": false
}
'import requests
url = "https://api.aisa.one/apis/v1/tavily/crawl"
payload = {
"url": "docs.tavily.com",
"instructions": "<string>",
"chunks_per_source": 3,
"max_depth": 1,
"max_breadth": 20,
"limit": 50,
"select_paths": ["<string>"],
"select_domains": ["<string>"],
"exclude_paths": ["<string>"],
"exclude_domains": ["<string>"],
"allow_external": True,
"include_images": False,
"extract_depth": "basic",
"format": "markdown",
"include_favicon": False,
"timeout": 150,
"include_usage": False
}
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({
url: 'docs.tavily.com',
instructions: '<string>',
chunks_per_source: 3,
max_depth: 1,
max_breadth: 20,
limit: 50,
select_paths: ['<string>'],
select_domains: ['<string>'],
exclude_paths: ['<string>'],
exclude_domains: ['<string>'],
allow_external: true,
include_images: false,
extract_depth: 'basic',
format: 'markdown',
include_favicon: false,
timeout: 150,
include_usage: false
})
};
fetch('https://api.aisa.one/apis/v1/tavily/crawl', 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.aisa.one/apis/v1/tavily/crawl",
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([
'url' => 'docs.tavily.com',
'instructions' => '<string>',
'chunks_per_source' => 3,
'max_depth' => 1,
'max_breadth' => 20,
'limit' => 50,
'select_paths' => [
'<string>'
],
'select_domains' => [
'<string>'
],
'exclude_paths' => [
'<string>'
],
'exclude_domains' => [
'<string>'
],
'allow_external' => true,
'include_images' => false,
'extract_depth' => 'basic',
'format' => 'markdown',
'include_favicon' => false,
'timeout' => 150,
'include_usage' => false
]),
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.aisa.one/apis/v1/tavily/crawl"
payload := strings.NewReader("{\n \"url\": \"docs.tavily.com\",\n \"instructions\": \"<string>\",\n \"chunks_per_source\": 3,\n \"max_depth\": 1,\n \"max_breadth\": 20,\n \"limit\": 50,\n \"select_paths\": [\n \"<string>\"\n ],\n \"select_domains\": [\n \"<string>\"\n ],\n \"exclude_paths\": [\n \"<string>\"\n ],\n \"exclude_domains\": [\n \"<string>\"\n ],\n \"allow_external\": true,\n \"include_images\": false,\n \"extract_depth\": \"basic\",\n \"format\": \"markdown\",\n \"include_favicon\": false,\n \"timeout\": 150,\n \"include_usage\": false\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.aisa.one/apis/v1/tavily/crawl")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"docs.tavily.com\",\n \"instructions\": \"<string>\",\n \"chunks_per_source\": 3,\n \"max_depth\": 1,\n \"max_breadth\": 20,\n \"limit\": 50,\n \"select_paths\": [\n \"<string>\"\n ],\n \"select_domains\": [\n \"<string>\"\n ],\n \"exclude_paths\": [\n \"<string>\"\n ],\n \"exclude_domains\": [\n \"<string>\"\n ],\n \"allow_external\": true,\n \"include_images\": false,\n \"extract_depth\": \"basic\",\n \"format\": \"markdown\",\n \"include_favicon\": false,\n \"timeout\": 150,\n \"include_usage\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/tavily/crawl")
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 \"url\": \"docs.tavily.com\",\n \"instructions\": \"<string>\",\n \"chunks_per_source\": 3,\n \"max_depth\": 1,\n \"max_breadth\": 20,\n \"limit\": 50,\n \"select_paths\": [\n \"<string>\"\n ],\n \"select_domains\": [\n \"<string>\"\n ],\n \"exclude_paths\": [\n \"<string>\"\n ],\n \"exclude_domains\": [\n \"<string>\"\n ],\n \"allow_external\": true,\n \"include_images\": false,\n \"extract_depth\": \"basic\",\n \"format\": \"markdown\",\n \"include_favicon\": false,\n \"timeout\": 150,\n \"include_usage\": false\n}"
response = http.request(request)
puts response.read_body{
"base_url": "<string>",
"results": [
{
"url": "<string>",
"raw_content": "<string>",
"favicon": "<string>"
}
],
"response_time": 123,
"usage": {
"credits": 123
},
"request_id": "<string>"
}授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json
开始抓取的根 URL。
示例:
"docs.tavily.com"
用于爬虫的自然语言指令。
每个来源返回的相关文本块的最大数量。
必填范围:
1 <= x <= 5最大抓取深度。
必填范围:
1 <= x <= 5树中每一层可跟踪的最大链接数量。
必填范围:
1 <= x <= 500爬虫停止前将处理的链接总数。
必填范围:
x >= 1用于仅选择具有特定路径模式的 URL 的正则表达式模式。
用于选择仅抓取特定域名或子域名的正则表达式模式。
用于排除具有特定路径模式的 URL 的正则表达式模式。
用于从抓取中排除特定域名或子域名的正则表达式模式。
在最终结果列表中包含外部域名链接。
在抓取结果中包含图片。
提取过程的深度。
可用选项:
basic, advanced 提取的网页内容格式。
可用选项:
markdown, text 为每个结果包含 favicon URL。
等待抓取操作完成的最长时间(秒)。
必填范围:
10 <= x <= 150在响应中包含信用额度用量信息。
⌘I