MarkUDown

Dataset API — MarkUDown 分页列表抓取文档

POST/api/dataset

Dataset

自动翻页抓取列表页,并将每个条目提取为结构化数据集。在第 1 页发现条目的 CSS 选择器,用它们在后续页面快速提取;选择器不再匹配时回退到 LLM。

参数类型必填默认值描述
urlstring必填—列表第一页的 URL。
goalstring必填—用自然语言描述要从每个条目中提取的内容。
schemaobject可选null每个条目的字段定义,例如 {"title": "string", "price": "number"}。
max_pagesinteger可选10最多翻页的页数(1–50)。任务开始时按此数量扣除积分。
timeoutinteger可选180每个页面的超时时间(秒)。
countrystring可选null两位大写国家代码(ISO 3166-1),例如 "BR":加载页面所用的国家。不传时根据 URL 的域名推断。
citystring可选null小写城市名,不含空格或分隔符,例如 "saopaulo"。需要同时传 country。
callback_urlstring可选null任务完成时接收结果(POST)的 webhook URL。

请求

{
  "url": "https://books.toscrape.com",
  "goal": "Extract all books with title, price and rating",
  "schema": {
    "title": "string",
    "price": "string",
    "rating": "string"
  },
  "max_pages": 50
}

响应

{
  "success": true,
  "id": "job_abc123",
  "url": "/api/dataset/job_abc123"
}

// Poll GET /api/dataset/{id} — "data" when completed:
{
  "success": true,
  "url": "https://books.toscrape.com",
  "goal": "Extract all books...",
  "total_records": 1000,
  "pages_scraped": 50,
  "output_format": "json",
  "data": [
    { "title": "A Light in the Attic", "price": "£51.77", "rating": "Three" }
  ],
  "processing_time_ms": 124300
}