配置 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 | 否 | - | 启用 readability 处理,聚焦主要内容 |
target_selector | string | 否 | - | 目标 CSS selector,例如 article.main-content |
wait_for_selector | string | 否 | - | 等待 selector 出现后再提取,适合动态页面 |
set_cookies | array | 否 | - | 随请求发送 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 从页面中提取聚焦内容