MarkUDown

Prompt Extract API — MarkUDown LLM 网页数据提取文档

POST/api/prompt-extract

提示词提取(Prompt Extract)

用一条自然语言指令从页面提取数据——无需 schema。LLM 自行决定字段名,返回 JSON 对象数组。

参数类型必填默认值描述
urlstring必填—要提取数据的页面 URL。
promptstring必填—用自然语言说明要提取什么。
main_contentboolean可选true只提取主要内容(去掉导航、页眉和页脚)。
timeoutinteger可选60页面加载超时时间(秒)。
callback_urlstring可选null任务完成时接收结果(POST)的 webhook URL。

请求

curl -X POST https://api.scrapetechnology.com/api/prompt-extract \
  -H "X-API-KEY: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://quotes.toscrape.com/", "prompt": "Every quote with its author and tags"}'

响应

// POST returns { "success": true, "id": "abc123", "url": "/api/extract/abc123" }
// Poll GET /api/extract/{id}
{
  "success": true,
  "id": "abc123",
  "status": "completed",
  "data": {
    "success": true,
    "data": [
      {
        "quote": "The world as we have created it is a process of our thinking...",
        "author": "Albert Einstein",
        "tags": ["change", "deep-thoughts", "thinking", "world"]
      }
    ],
    "total": 1,
    "url": "https://quotes.toscrape.com/",
    "processing_time_ms": 5400
  }
}

Python — pip install markudown

from markudown import MarkUDown

md = MarkUDown(api_key="your-api-key")
job = md.prompt_extract("https://quotes.toscrape.com/", "Every quote with its author and tags")
print(job["data"]["data"])

Node.js — npm install markudown-sdk

import { MarkUDown } from "markudown-sdk";

const md = new MarkUDown({ apiKey: "your-api-key" });
const job = await md.promptExtract("https://quotes.toscrape.com/", "Every quote with its author and tags");
console.log(job.data.data);
Prompt Extract 任务在 GET /api/extract/{id} 轮询(不是 /api/prompt-extract)。只有页面 Markdown 的前 50,000 个字符会发送给 LLM。

费用: 每次请求 5 个积分。