設定 Harness
Web Fetch API
透過 selector 和 readability 選項,將網頁內容擷取為 HTML、text 或 Markdown。
POST
/v2/web/extract認證
Bearer API key
Content type
application/json
限流說明
可能適用 endpoint 專屬限制。
Web Fetch API 從目標 URL 擷取內容,並返回更適合 agents、RAG systems 和 content workflows 處理的結果。它可返回 HTML、plain text 或 Markdown,並支援 selectors、readability options、cache control、custom user agents 和 request cookies。
Endpoint
POST https://openapi.felo.ai/v2/web/extract認證
Authorization: Bearer YOUR_API_KEYBody Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | 是 | - | 要擷取的網頁 URL |
crawl_mode | string | 否 | fast | fast 更快;fine 更精細,適合複雜頁面 |
output_format | string | 否 | html | 支援 html、text、markdown |
with_readability | boolean or string | No | - | 啟用 readability 處理,聚焦主要內容 |
target_selector | string | 否 | - | 目標 CSS selector,例如 article.main-content |
wait_for_selector | string | 否 | - | 等待 selector 出現後再擷取,適合動態頁面 |
set_cookies | array | No | - | 隨請求傳送 cookies |
user_agent | string | 否 | - | 自定義 User-Agent |
timeout | integer | 否 | - | 請求 timeout,單位 ms |
回應
data 採用透明透傳設計,具體欄位取決於 output_format 和 options。
{
"status": "ok",
"message": null,
"data": { "content": "# Example Article
Extracted article content..." }
}Error Responses
| HTTP Status | Error Code | 說明 | 建議操作 |
|---|---|---|---|
| 400 | WEB_EXTRACT_FAILED | URL 無效、請求引數錯誤或 extractor 返回客戶端錯誤 | 檢查 url、selectors 和引數 |
| 401 | INVALID_API_KEY | API key 缺失、無效或已撤銷 | 檢查 API key 和 authorization header |
| 500 | WEB_EXTRACT_FAILED | 內部服務錯誤 | 重試;持續失敗請聯絡 support |
Example
curl -X POST https://openapi.felo.ai/v2/web/extract -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"url":"https://example.com/article","output_format":"markdown","with_readability":true}'使用場景
- 在 Agent 回答問題前提供網頁上下文
- 為 RAG ingestion 或 knowledge base creation 擷取文章正文
- 將網頁轉換為 Markdown,用於歸檔或文件工作流
- 使用 CSS selectors 從頁面中擷取聚焦內容