提取网页内容
从一个或多个 URL 提取正文内容,供大模型使用。
/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_results` of 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_source` to define the maximum number of relevant chunks returned per source and to control the `raw_content` length. Chunks will appear in the `raw_content` field as: `<chunk 1> [...] <chunk 2> [...] <chunk 3>`. Available only when `query` is provided. Must be between 1 and 5.
extract_depthstring可选The depth of the extraction process. `advanced` extraction retrieves more data, including tables and embedded content, with higher success but may increase latency.`basic` extraction costs 1 credit per 5 successful URL extractions, while `advanced` extraction 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. `markdown` returns content in markdown format. `text` returns 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](https://docs.tavily.com/documentation/api-credits) for details.
返回
200
错误按 Tavily 格式返回,参见 错误码
响应
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. |