MarkUDown
Smart Extract API — MarkUDown AI 网页提取 API 文档
POST
/api/smart-extractSmart Extract
三阶段引导式提取:先分析网站难度,再用 LLM 规划所需的交互,最后自动执行导航与提取。返回 Markdown 或结构化 JSON。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| url | string | 必填 | — | 要提取数据的页面或网站 URL。 |
| goal | string | 必填 | — | 用自然语言描述要提取的内容。 |
| hints | array<string> | 可选 | [] | 可选的交互提示(例如 "点击加载更多按钮")。 |
| schema | object | 可选 | null | 结构化输出的字段定义,例如 {"title": "string", "price": "number"}。json_data 需要它。 |
| output_format | string | 可选 | "markdown" | "markdown" 或 "json"。使用 "json" 并提供 schema 时,记录也会在 json_data 中返回。 |
| max_pages | integer | 可选 | 20 | 提取过程中最多遍历的页面数。 |
| timeout | integer | 可选 | 60 | 每个页面的超时时间(秒)。 |
| callback_url | string | 可选 | null | 任务完成时接收结果(POST)的 webhook URL。 |
请求
{
"url": "https://books.toscrape.com",
"goal": "Extract all books with title, price and rating",
"output_format": "json",
"schema": {
"title": "string",
"price": "string",
"rating": "string"
},
"max_pages": 10
}响应
{
"success": true,
"id": "job_abc123",
"url": "/api/smart-extract/job_abc123"
}
// Poll GET /api/smart-extract/{id}
{
"success": true,
"id": "job_abc123",
"status": "completed",
"data": {
"success": true,
"data": {
"url": "https://books.toscrape.com",
"markdown": "# Books\n\n...",
"json_data": [
{ "title": "A Light in the Attic", "price": "£51.77", "rating": "Three" }
],
"metadata": {
"layer_used": "playwright",
"pages_traversed": 4,
"records_extracted": 80,
"difficulty": "medium",
"actions_executed": 3,
"planner_reasoning": "...",
"duration_ms": 38200
}
},
"processing_time_ms": 38400
}
}