BazaarLinkBazaarLink
登入
文件API 參考SDK 參考Agent 應用AI Skills
網路搜尋

爬取網頁

從根網址探索網站連結圖並擷取內容。使用 Bearer API 金鑰,或將 api_key 放在 JSON body 作為相容性回退;支援 https://api.bazaarlink.ai/v1 與 https://bazaarlink.ai/api/v1。未知欄位會被忽略。回應包含成功頁面、response_time、usage.credits、我們加上的 usage.cost(依管理員設定的每 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

要開始爬取的根網址;可省略 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 個成功擷取的頁面擷取成本加倍。

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 是依管理員設定單價計算的客戶價格。

{
  "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"
}
客服
客服
您好!有什麼可以協助?
請留下訊息,我們會盡快回覆。