提取网页内容
/search/v1/extract● 支持请求体
querystring可选User intent for reranking extracted content chunks. When provided, chunks are reranked based on relevance to this query.
urlsstring | array必填URL to extract, or an array of up to 20 URLs. Per-URL failures are listed in
failed_resultsof the response, which can come with HTTP 200.chunks_per_sourceinteger可选Chunks are short content snippets (maximum 500 characters each) pulled directly from the source. Use
chunks_per_sourceto define the maximum number of relevant chunks returned per source and to control theraw_contentlength. Chunks will appear in theraw_contentfield as:<chunk 1> [...] <chunk 2> [...] <chunk 3>. Available only whenqueryis provided. Must be between 1 and 5.extract_depthstring可选The depth of the extraction process.
advancedextraction retrieves more data, including tables and embedded content, with higher success but may increase latency.basicextraction costs 1 credit per 5 successful URL extractions, whileadvancedextraction costs 2 credits per 5 successful URL extractions.include_imagesboolean可选Include a list of images extracted from the URLs in the response. Default is false.
include_faviconboolean可选Whether to include the favicon URL for each result.
formatstring可选The format of the extracted web page content.
markdownreturns content in markdown format.textreturns plain text and may increase latency.timeoutnumber可选Maximum time in seconds to wait for the URL extraction before timing out. Must be between 1.0 and 60.0 seconds. If not specified, default timeouts are applied based on extract_depth: 10 seconds for basic extraction and 30 seconds for advanced extraction.
include_usageboolean可选Whether to include credit usage information in the response.
NOTE:The value may be 0 if the total successful URL extractions has not yet reached 5 calls. See our Credits & Pricing documentation for details.
返回
200
错误按 Tavily 格式返回,参见 错误码
请求示例
curl
curl https://api.deepraxis.com/search/v1/extract \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"urls":["https://en.wikipedia.org/wiki/Artificial_intelligence"]}'Python
from tavily import TavilyClient
tavily_client = TavilyClient(
api_key="$PRAXIS_API_KEY",
api_base_url="https://api.deepraxis.com/search/v1",
)
response = tavily_client.extract("https://en.wikipedia.org/wiki/Artificial_intelligence")
print(response)TypeScript
import { tavily } from "@tavily/core";
const tvly = tavily({
apiKey: "$PRAXIS_API_KEY",
apiBaseURL: "https://api.deepraxis.com/search/v1",
});
const response = await tvly.extract("https://en.wikipedia.org/wiki/Artificial_intelligence");
console.log(response);响应示例 200
{
"results": [
{
"url": "https://en.wikipedia.org/wiki/Artificial_intelligence",
"title": "Artificial intelligence - Wikipedia",
"raw_content": " Artificial intelligence - Wikipedia \n[Jump to content](#bodyContent)\n\nMain menu \n\nMain menu\n\nmove to sidebar hide\n\nNavigation\n\n* [Main page](/wiki/Main_Page \"Visit the main page …(采样时截断:原文共 626370 字符,此处保留前 200)",
"images": []
}
],
"failed_results": [],
"response_time": 0.02,
"usage": {
"credits": 1
},
"request_id": "5d179676-0c71-4e7e-86a6-c49c42d008cf"
}响应
HTTP 200
Extraction completed. Check results and failed_results for each URL. HTTP 200 can have an empty results array when all valid URLs fail during extraction; output order is not guaranteed.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| results | array<object> | A list of extracted content from the provided URLs. |
| results[].url | string | The URL from which the content was extracted. |
| results[].raw_content | string | The full content extracted from the page. When query is provided, contains the top-ranked chunks joined by [...] separator. |
| results[].images | array<string> | This is only available if include_images is set to true. A list of image URLs extracted from the page. |
| results[].favicon | string | The favicon URL for the result. |
| failed_results | array<object> | A list of URLs that could not be processed. |
| failed_results[].url | string | The URL that failed to be processed. |
| failed_results[].error | string | An error message describing why the URL couldn't be processed. |
| response_time | number | Time in seconds it took to complete the request. |
| usage | object | Credit usage details for the request. |
| request_id | string | A unique request identifier you can share with customer support to help resolve issues with specific requests. |