BazaarLinkBazaarLink
登入
文件API 参考SDK 参考Agent 应用AI Skills
网络搜索

爬取网页

从根 URL 探索网站链接图并提取成功页面的内容。支持 Bearer API 密钥,也支持将 api_key 放在 JSON body 中作为兼容性回退;https://api.bazaarlink.ai/v1 和 https://bazaarlink.ai/api/v1 均可使用。未知字段会被忽略。响应包含成功页面、response_time、usage.credits、我们附加的 usage.cost(credits 乘以管理员设置的每 credit 价格)和 request_id。Tavily 的 timeout 接受 10–150 秒,但 BazaarLink 的有效上限是 90 秒;超过 90 的值会降低到 90,以保持低于 100 秒的边缘代理限制。 计费为 mapping 成本加 extraction 成本:10 个 basic 成功页面是 1 + 2 = 3 credits;advanced extraction 会使 extraction 部分加倍,instructions 会使 mapping 部分加倍。失败页面免费。实际 credits 从共享的每日免费额度扣除;如果根据 limit 的估算超过剩余额度,超出部分从余额计费;没有余额则返回 432 并建议降低 limit。 SDK 示例;请将密钥放在环境变量或其他安全的服务端配置中。 Python: from tavily import TavilyClient client = TavilyClient(api_key="...", api_base_url="https://api.bazaarlink.ai/v1") response = client.crawl("docs.tavily.com", instructions="Find Python SDK pages") JavaScript: import { tavily } from "@tavily/core" const tvly = tavily({ apiKey: process.env.BAZAARLINK_API_KEY, apiBaseURL: "https://api.bazaarlink.ai/v1" }) const response = await tvly.crawl("docs.tavily.com", { instructions: "Find Python SDK pages" }) LangChain (crawl only): from langchain_tavily import TavilyCrawl tool = TavilyCrawl(api_key="...", api_base_url="https://api.bazaarlink.ai/v1") response = tool.invoke({"url": "docs.tavily.com", "instructions": "Find Python SDK pages"})

POST/v1/crawl

验证

Authorization必填
string · header

在 Authorization 标头以 Bearer token 传入 API 密钥。

Body

url必填
string

开始爬取的根 URL;可以省略 scheme,例如 docs.tavily.com。

required; scheme optional
Example: "docs.tavily.com"
instructions
string

告诉爬取器要查找的内容;提供后可使用 chunks_per_source,并使每 10 个成功页面的 mapping 部分变为 2 credits。

Example: "Find Python SDK pages"
chunks_per_source
integer

每个来源最多保留的短内容片段数;仅在提供 instructions 时可用,范围 1–5,默认 3。

1-5; only with instructions; default: 3
Example: 3
max_depth
integer

爬取深度,范围 1–5,默认 1。

1-5; default: 1
Example: 1
max_breadth
integer

每层每页最多跟随的链接数,范围 1–500,默认 20。

1-500; default: 20
Example: 20
limit
integer

停止前处理的链接总数,最小 1,默认 50。

minimum: 1; default: 50
Example: 50
select_paths
string[]

路径选择 的正则表达式数组;最多 50 个条目,每个表达式最多 200 个字符。

max 50 entries; max 200 characters per regex
Example: ["^/docs/.*"]
select_domains
string[]

域名选择 的正则表达式数组;最多 50 个条目,每个表达式最多 200 个字符。

max 50 entries; max 200 characters per regex
Example: ["^docs\.example\.com$"]
exclude_paths
string[]

路径排除 的正则表达式数组;最多 50 个条目,每个表达式最多 200 个字符。

max 50 entries; max 200 characters per regex
Example: ["^/private/.*"]
exclude_domains
string[]

域名排除 的正则表达式数组;最多 50 个条目,每个表达式最多 200 个字符。

max 50 entries; max 200 characters per regex
Example: ["^private\.example\.com$"]
allow_external
boolean

是否将外部域名链接纳入结果,默认 true。

default: true
Example: true
include_images
boolean

是否包含从页面提取的图片,默认 false。

default: false
Example: false
extract_depth
string

提取深度;advanced 可处理更多表格和嵌入内容,并使每 5 个成功页面的提取部分 credits 加倍。

default: basic
basicadvanced
Example: "basic"
format
string

提取页面内容的格式:markdown 或纯文本,默认 markdown。

default: markdown
markdowntext
Example: "markdown"
include_favicon
boolean

是否在每条结果中包含 favicon URL,默认 false。

default: false
Example: false
timeout
number

等待爬取完成的秒数。Tavily 范围为 10–150,但 BazaarLink 的有效上限是 90 秒;超过 90 会降低到 90。

Tavily: 10-150; BazaarLink default/effective maximum: 90 seconds; values above 90 are lowered to 90
Example: 90
include_usage
boolean

是否在响应中包含 usage,默认 false;包含时会显示 credits 和 usage.cost。

default: false
Example: false
POST /v1/crawl
curl https://api.bazaarlink.ai/v1/crawl   -H "Authorization: Bearer $BAZAARLINK_API_KEY"   -H "Content-Type: application/json"   -d '{
    "url": "docs.tavily.com",
    "instructions": "Find Python SDK pages",
    "limit": 20,
    "timeout": 90,
    "include_usage": true
  }'
响应示例

爬取成功。results 仅包含成功页面;usage.credits 是实际 credits,usage.cost 是按管理员设置的每 credit 价格计算的客户价格。

{
  "base_url": "docs.tavily.com",
  "results": [
    {
      "url": "https://docs.tavily.com/welcome",
      "raw_content": "Welcome to the docs",
      "favicon": "https://docs.tavily.com/favicon.ico"
    }
  ],
  "response_time": 1.23,
  "usage": {
    "credits": 3,
    "cost": 0.03
  },
  "request_id": "crawl_123e4567-e89b-12d3-a456-426614174111"
}
客服
客服
您好!有什么可以协助?
请留下消息,我们会尽快回复。