← 返回接入教程
POST

/api/proxy/crawl · Crawl 爬取

从一个起始 URL 开始,按深度和范围遍历爬取整个站点,返回每个页面的结构化内容。

请求参数
参数
类型
说明
url*
string起始 URL,作为爬取入口
max_depth
integer最大爬取深度,默认 2
max_breadth
integer每层最多爬取的页面数,默认 8
limit
integer整次爬取总页面数上限,默认 10
instructions
string自然语言指引,引导爬取方向
select_paths
array只爬取匹配路径前缀的链接(正则)
exclude_paths
array跳过匹配路径前缀的链接(正则)
allow_backward_links
boolean是否允许跳出当前路径层级,默认 false
allow_external
boolean是否允许爬取外站链接,默认 false
extract_depth
string页面抽取深度:basic | advanced,默认 basic
代码示例
cURL
Python
JavaScript
Go
curl -X POST https://tavily.sharyuke.com/api/proxy/crawl \
  -H "Authorization: Bearer thb-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com", "max_depth": 2, "limit": 10 }'
响应示例
{ "code": 0, "message": "ok", "data": { "ok": true, "data": { "base_url": "https://example.com", "results": [{ "url": "https://example.com/", "raw_content": "..." }], "failed_results": [], "response_time": 3.6 }, "credits": 1 } }
错误码
错误码
含义
处理建议
400请求参数错误检查请求体字段
401API Key 无效检查 Authorization 头
429超过速率限制降低请求频率
500内部错误稍后重试或联系支持
503上游服务不可用网关已自动重试,请稍候

准备好接入了吗?

邮箱注册即可免费使用,每月 7,200 次免费调用,无需信用卡。