{
"data": [
{
"value": "4010.00",
"raw_text": "4,010.00"
}
],
"validation": {
"status": "ok",
"reason": "no_reference",
"value": 4010,
"model_value": 4010,
"raw_text": "4,010.00",
"reference": null,
"change_pct": null,
"suspect_pct": 10,
"reject_pct": 30,
"on_page": true,
"votes": [],
"mode": "shadow",
"reference_source": null
}
}
curl --location --request GET 'https://zylalabs.com/api/14429/structured+data+from+web+page+api/36439/extract+from+page?url=https://www.investing.com/commodities/gold&parse_description=Current gold futures price as a plain number, in a field called value&expiration_seconds=600&raw_text=true&value_field=value&last_value=4012.5&max_chars=6000' --header 'Authorization: Bearer YOUR_API_KEY'
{
"data": [
{
"value": 4066.5
}
],
"validation": {
"status": "ok",
"reason": "no_reference",
"value": 4066.5,
"model_value": 4066.5,
"raw_text": null,
"suspect_pct": 10,
"reject_pct": 30,
"on_page": null,
"votes": [],
"mode": "shadow"
}
}
curl --location --request GET 'https://zylalabs.com/api/14429/structured+data+from+web+page+api/36440/extract+from+screenshot?url=https://www.investing.com/commodities/gold&llm_instructions=Current gold price in USD as a number, in a field called value&expiration_seconds=600&value_field=value&last_value=4012.5' --header 'Authorization: Bearer YOUR_API_KEY'
注册后,每个开发者都会被分配一个个人 API 访问密钥,这是一个唯一的字母和数字组合,用于访问我们的 API 端点。要使用 Structured Data From Web Page API 进行身份验证,只需在 Authorization 标头中包含您的 bearer token。
| 标头 | 描述 |
|---|---|
授权
|
必需
应为 Bearer access_key. 订阅后,请查看上方的"您的 API 访问密钥"。
|
Structured Data From Web Page API turns any public web page into structured JSON. Send a URL and say in plain language what you need, for example current gold futures price as a number, in a field called value. The service fetches the page, prunes it, asks a large language model for exactly those fields and returns them as JSON.
Language models misread pages: they drop a decimal point (27015 instead of 270.15), pick a neighbouring row, or echo a number from the instruction. Every numeric answer is therefore checked before it is returned:
last_value if you send yours).The result comes in a validation object: status (ok, suspect, rejected or unchecked), reason, raw_text exactly as written on the page, on_page, and the thresholds used. The check is informational: you always receive the answer and decide what to do with it. The same pipeline runs in production on hundreds of thousands of extractions per month for commodity, metal and index prices.
Both accept an optional cache window (expiration_seconds, default 10 minutes), your own reference value (last_value) and the name of the field that holds the number when the answer has several (value_field).
Request: the URL of a gold futures quote page and parse_description=Current gold futures price as a plain number, in a field called value
{
"data": [{ "value": "4010.00", "raw_text": "4,010.00" }],
"validation": {
"status": "ok", "reason": "no_reference",
"value": 4010.0, "raw_text": "4,010.00", "on_page": true,
"suspect_pct": 10.0, "reject_pct": 30.0
}
}
Name the fields you want back and be specific about which number: "the Last Price in the quote header, keeping its decimal point, in a field called value" works better than "the price". Do not put example numbers or ranges in the instruction: if the data is missing, a model tends to return the example.
一个包含两个部分的JSON对象:数据,您在指令中要求的字段,和验证,主要数值的检查(状态正常、可疑、拒绝或未检查,原因,页面上写的原始文本和使用的阈值)
用简单的语言,通过parse_description(文本端点)或llm_instructions(截图端点)返回你想要的字段,例如“产品名称,价格以数字形式表示的美元和库存状态,分别在名为name,price和in_stock的字段中”
默认使用从页面提取:它更快并且适用于页面文本。当数据仅在页面渲染后显示时,例如图表、小部件、画布表或重JavaScript应用程序时,请切换到从截图提取
无论数字是否实际上写在页面上(on_page),是否看起来像十进制位移(x10,x100),以及它距离上一个已接受的相同URL和指令的值移动了多远。您总是会收到答案;状态告诉您要信任它多少
是的 发送last_value与您为该URL和指令存储的最后一个数字进行比较 验证将与它进行比较而不是服务历史记录 当您的答案有多个数字时使用value_field
不 页面和答案会在相同的 URL 和指令下重用 只要它们的年龄小于 expiration_seconds(默认 600 秒)发送 0 强制重新获取
从页面提取读取服务器渲染的文本 对于只有在页面运行其脚本后才出现的内容,请使用从屏幕截图提取,它在浏览器中渲染页面然后读取它
响应带有错误为真以及描述问题的信息(被阻止的页面 超时 上游错误)该调用不被视为成功
两个端点返回结构化的JSON数据。提取自页面的端点根据您的简明请求提供字段,而从屏幕截图提取的端点返回从渲染内容中获取的数据。每个响应都包括一个验证对象,状态为数字值。
响应数据中的关键字段包括“value”用于提取的数字数据,“raw_text”用于页面的原始文本,以及“validation”对象,其中包含与数字值相关的状态、原因和检查
返回的数据采用JSON格式,结构包括一个包含请求字段的"data"数组和一个"validation"对象。"validation"对象包括"status"、"reason"和产生该状态的检查等字段
从页面提取可以获取基于文本的数据,如价格、规格和可用性 从截图提取适合视觉数据,如需要渲染的图表和小部件 两个端点可以根据用户指令提取各种数字和文本信息
用户可以通过指定Extract From Page的"parse_description"或Extract From Screenshot的"llm_instructions"来自定义请求 他们可以定义想要的字段,例如"current temperature as a number in field called temp",从而实现定制的数据提取
响应数据被组织为两个主要部分:“数据”,其中包含提取的字段,以及“验证”,其中包含数值的状态。这种结构使用户能够一起查看结果和状态
数据来自公开可访问的网页 API直接从指定的URL获取内容 验证将提取的值与页面文本进行比较并添加状态 不会更改值
一个验证层会将数值与页面文本、历史数据和潜在的小数位偏移进行检查。每个响应都包含一个验证状态。提取的值总是会返回,而状态则表示置信度