POST
/extract
AI 智能结构化提取

使用 AI 从网页提取结构化数据。用 JSON Schema 定义所需的输出结构,我们的 AI 将智能提取信息。

使用场景:

  • 从电商页面提取产品信息
  • 将招聘信息解析为结构化格式
  • 提取联系信息和企业详情
  • 将新闻文章转换为结构化数据
  • 抓取价格表和规格参数

工作原理:

  1. 提供 URL 和定义所需结构的 JSON Schema
  2. 我们的 AI 分析页面内容
  3. 提取匹配 Schema 的数据
  4. 返回经过验证的 JSON 输出

Schema 定义:

使用 JSON Schema 定义所需的输出结构:

  • 字段类型:string、number、boolean、array、object
  • 字段描述:帮助 AI 理解要提取的内容
  • 必填字段:将关键字段标记为必填
  • 嵌套结构:支持复杂的嵌套数据

Schema 示例:

{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "产品名称或标题"
    },
    "price": {
      "type": "number",
      "description": "当前价格(美元)"
    },
    "availability": {
      "type": "boolean",
      "description": "产品是否有库存"
    },
    "features": {
      "type": "array",
      "items": {"type": "string"},
      "description": "主要产品特性列表"
    }
  },
  "required": ["title", "price"]
}

授权

YOUR_API_KEY
授权Bearer <token>

在 Thunderbit Dashboard 获取 API key。请求头格式:Authorization: Bearer YOUR_API_KEY

位置: header

请求体

application/json

TypeScript Definitions

Use the request body type in TypeScript.

url*string必填

要提取数据的网页 URL

示例:https://thunderbit.com/playground
schemaobject

JSON Schema。可选——省略时,Thunderbit 会根据页面内容自动生成 Schema。

示例:
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Product name"
    },
    "price": {
      "type": "number",
      "description": "Product price"
    },
    "currency": {
      "type": "string",
      "description": "Currency unit"
    }
  },
  "required": [
    "name",
    "price"
  ]
}
timeoutnumber默认值:60000

请求超时时间(毫秒),默认 30000

取值范围:5000 <= x <= 120000
示例:
60000
waitFornumber默认值:0

页面加载后等待动态内容渲染的时间(毫秒,默认 0,最大 10000)

取值范围:0 <= x <= 10000
示例:
2000
renderModestring默认值:"none"

JavaScript 渲染模式。none = 不渲染 JS(默认);basic = 标准渲染;full = 延长等待以处理动态内容

取值范围"none" | "basic" | "full"
formatsany[]

输出格式(与 Distill 的 formats 数组结构相同)。

示例:
[
  "markdown",
  "links",
  "images"
]

响应

application/json

Success response

successboolean
示例:
true
dataobject
展开子属性
urlstring
示例:https://thunderbit.com/playground
dataobject[]

Extracted structured data matching your schema, returned as an array where each item is a key-value map

示例:
[
  {
    "name": "iPhone 15 Pro",
    "price": 999,
    "currency": "USD",
    "availability": true,
    "rating": 4.7,
    "features": [
      "A17 Pro chip with 6-core GPU",
      "Pro camera system with 48MP main camera",
      "Titanium design with textured matte glass"
    ]
  }
]
linksobject[]

从页面提取的链接。

展开子属性
textstring

Visible link text.

示例:Read more
hrefstring

Resolved absolute URL.

示例:https://example.com/article
imagesobject[]

从页面提取的图像。

展开子属性
srcstring

Image source URL.

示例:https://example.com/hero.png
altstring

Image alt text.

示例:Hero banner
widthinteger

Image width in pixels.

heightinteger

Image height in pixels.

summarystring

页面摘要(LLM 格式)。

answerstring

question 格式中提供的问题的回答。

highlightsstring[]

高亮段落。

metadataobject
展开子属性
titlestring

Page title extracted from tag or Open Graph

示例:iPhone 15 Pro - Apple
descriptionstring

Meta description or excerpt

示例:The ultimate iPhone with A17 Pro chip.
languagestring

Detected language code (ISO 639-1)

示例:en
authorstring

Article author if available

示例:
null
publishedDatestring

Publication date if available

示例:
null
imagestring

Featured image URL from Open Graph or Twitter Card

示例:https://example.com/product/iphone-15-pro.jpg
sourceURLstring

源 URL

示例:https://example.com/product/iphone-15-pro
statusCodeinteger

HTTP 状态码

示例:
200
contentLengthinteger

Length of the markdown content in characters

示例:
5000