使用 Tavily Extract 从指定 URL 提取网页内容。
curl --request POST \
--url https://api.aisa.one/apis/v1/tavily/extract \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"urls": [
"https://en.wikipedia.org/wiki/Artificial_intelligence"
],
"query": "<string>",
"chunks_per_source": 3,
"extract_depth": "basic",
"include_images": false,
"include_favicon": false,
"format": "markdown",
"timeout": 30.5,
"include_usage": false
}
'import requests
url = "https://api.aisa.one/apis/v1/tavily/extract"
payload = {
"urls": ["https://en.wikipedia.org/wiki/Artificial_intelligence"],
"query": "<string>",
"chunks_per_source": 3,
"extract_depth": "basic",
"include_images": False,
"include_favicon": False,
"format": "markdown",
"timeout": 30.5,
"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({
urls: ['https://en.wikipedia.org/wiki/Artificial_intelligence'],
query: '<string>',
chunks_per_source: 3,
extract_depth: 'basic',
include_images: false,
include_favicon: false,
format: 'markdown',
timeout: 30.5,
include_usage: false
})
};
fetch('https://api.aisa.one/apis/v1/tavily/extract', 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/extract",
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([
'urls' => [
'https://en.wikipedia.org/wiki/Artificial_intelligence'
],
'query' => '<string>',
'chunks_per_source' => 3,
'extract_depth' => 'basic',
'include_images' => false,
'include_favicon' => false,
'format' => 'markdown',
'timeout' => 30.5,
'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/extract"
payload := strings.NewReader("{\n \"urls\": [\n \"https://en.wikipedia.org/wiki/Artificial_intelligence\"\n ],\n \"query\": \"<string>\",\n \"chunks_per_source\": 3,\n \"extract_depth\": \"basic\",\n \"include_images\": false,\n \"include_favicon\": false,\n \"format\": \"markdown\",\n \"timeout\": 30.5,\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/extract")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://en.wikipedia.org/wiki/Artificial_intelligence\"\n ],\n \"query\": \"<string>\",\n \"chunks_per_source\": 3,\n \"extract_depth\": \"basic\",\n \"include_images\": false,\n \"include_favicon\": false,\n \"format\": \"markdown\",\n \"timeout\": 30.5,\n \"include_usage\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/tavily/extract")
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 \"urls\": [\n \"https://en.wikipedia.org/wiki/Artificial_intelligence\"\n ],\n \"query\": \"<string>\",\n \"chunks_per_source\": 3,\n \"extract_depth\": \"basic\",\n \"include_images\": false,\n \"include_favicon\": false,\n \"format\": \"markdown\",\n \"timeout\": 30.5,\n \"include_usage\": false\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"url": "<string>",
"title": "<string>",
"raw_content": "<string>",
"images": [
"<string>"
],
"favicon": "<string>"
}
],
"failed_results": [
"<string>"
],
"response_time": 123,
"usage": {
"credits": 123
},
"request_id": "<string>"
}搜索 API
Tavily 提取
使用 Tavily Extract 从指定 URL 提取网页内容。
POST
https://api.aisa.one/apis/v1
/
tavily
/
extract
使用 Tavily Extract 从指定 URL 提取网页内容。
curl --request POST \
--url https://api.aisa.one/apis/v1/tavily/extract \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"urls": [
"https://en.wikipedia.org/wiki/Artificial_intelligence"
],
"query": "<string>",
"chunks_per_source": 3,
"extract_depth": "basic",
"include_images": false,
"include_favicon": false,
"format": "markdown",
"timeout": 30.5,
"include_usage": false
}
'import requests
url = "https://api.aisa.one/apis/v1/tavily/extract"
payload = {
"urls": ["https://en.wikipedia.org/wiki/Artificial_intelligence"],
"query": "<string>",
"chunks_per_source": 3,
"extract_depth": "basic",
"include_images": False,
"include_favicon": False,
"format": "markdown",
"timeout": 30.5,
"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({
urls: ['https://en.wikipedia.org/wiki/Artificial_intelligence'],
query: '<string>',
chunks_per_source: 3,
extract_depth: 'basic',
include_images: false,
include_favicon: false,
format: 'markdown',
timeout: 30.5,
include_usage: false
})
};
fetch('https://api.aisa.one/apis/v1/tavily/extract', 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/extract",
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([
'urls' => [
'https://en.wikipedia.org/wiki/Artificial_intelligence'
],
'query' => '<string>',
'chunks_per_source' => 3,
'extract_depth' => 'basic',
'include_images' => false,
'include_favicon' => false,
'format' => 'markdown',
'timeout' => 30.5,
'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/extract"
payload := strings.NewReader("{\n \"urls\": [\n \"https://en.wikipedia.org/wiki/Artificial_intelligence\"\n ],\n \"query\": \"<string>\",\n \"chunks_per_source\": 3,\n \"extract_depth\": \"basic\",\n \"include_images\": false,\n \"include_favicon\": false,\n \"format\": \"markdown\",\n \"timeout\": 30.5,\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/extract")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://en.wikipedia.org/wiki/Artificial_intelligence\"\n ],\n \"query\": \"<string>\",\n \"chunks_per_source\": 3,\n \"extract_depth\": \"basic\",\n \"include_images\": false,\n \"include_favicon\": false,\n \"format\": \"markdown\",\n \"timeout\": 30.5,\n \"include_usage\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/tavily/extract")
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 \"urls\": [\n \"https://en.wikipedia.org/wiki/Artificial_intelligence\"\n ],\n \"query\": \"<string>\",\n \"chunks_per_source\": 3,\n \"extract_depth\": \"basic\",\n \"include_images\": false,\n \"include_favicon\": false,\n \"format\": \"markdown\",\n \"timeout\": 30.5,\n \"include_usage\": false\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"url": "<string>",
"title": "<string>",
"raw_content": "<string>",
"images": [
"<string>"
],
"favicon": "<string>"
}
],
"failed_results": [
"<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。支持单个 URL 字符串和 URL 字符串数组。
示例:
[
"https://en.wikipedia.org/wiki/Artificial_intelligence"
]用于对提取的内容块进行重新排序的用户意图。
每个来源返回的相关内容块的最大数量。仅在提供 query 时可用。
必填范围:
1 <= x <= 5提取过程的深度。
可用选项:
basic, advanced 包含从 URL 中提取的图片列表。
为每个结果包含 favicon URL。
提取的网页内容格式。
可用选项:
markdown, text 等待 URL 提取的最长时间(秒)。如果省略,默认超时时间取决于 extract_depth:basic 为 10 秒,advanced 为 30 秒。
必填范围:
1 <= x <= 60在响应中包含信用额度用量信息。
⌘I