Page
将公开网页读取为 Markdown,并获取其标题、作者、日期、站点名称、语言、主图和 schema.org JSON-LD。
GET | POST /v1/reader/page参数可以用 GET 的查询字符串发送,也可以用 POST 的 JSON 请求体发送,两者等价。使用查询字符串时,请对网页地址做 URL 编码。
请求
curl -G "https://gateway.apinoa.com/v1/reader/page" \
--data-urlencode "url=https://stephango.com/saw" \
-H "x-api-key: $APINOA_API_KEY"参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
url | string | 是 | The page's address, http or https. |
country | enum | Where the page is read from. US | |
include | string list | Extra fields, comma-separated: html (the page as fetched), contentHtml (its main content as HTML), text (its main content as plain text), links (the links in its main content), images (the images in its main content). | |
maxChars | integer 100–1000000 | Cut markdown (and text) to at most this many characters, at a paragraph break where one is near; truncated is then true. |
这些参数及所有响应类型也写在OpenAPI 文档中。
响应
在 data 中返回 ReaderPage。 一个真实响应的完整内容。
{
"success": true,
"data": {
"url": "https://stephango.com/saw",
"finalUrl": "https://stephango.com/saw",
"status": 200,
"contentType": "text/html; charset=UTF-8",
"title": "Use the saw, fear the saw",
"wordCount": 143,
"jsonLd": [],
"description": "It’s hard to make a saw that cuts trees but not arms.",
"author": "Steph Ango",
"published": "2025-10-20T00:00:00+00:00",
"site": "Steph Ango",
"language": "en",
"image": "https://stephango.com/assets/card.png",
"favicon": "https://stephango.com/favicon.ico",
"markdown": "When I learned to use a table saw, my teacher impressed upon me that the machine wants to cut fingers. Fear the saw!\n\nPowerful tools can do powerful things. If you want to make handmade wooden furniture you must cut wood. Your desire to have limbs and your desire to have furniture are not at odds if you learn to use tools safely.\n\nThere *are* table saws that will stop at the touch of a finger, but I don’t know of any chainsaw that won’t cut an arm. There is a limit to how safe a tool can be before its function is crippled.\n\nWe should not stop making powerful tools because they are dangerous. Rather, we should empower people to use powerful tools safely.\n\nI use the saw, I fear the saw. I have handmade furniture, and I have all my limbs."
}
}错误
| 状态 | 代码 | 含义 |
|---|---|---|
| 400 | INVALID_PARAMS | 缺少 url,或它不是 http/https 地址,或是私有或内部地址;有未知或超出范围的参数;或该地址返回的不是网页(PDF、图片、JSON)。消息中会说明原因并给出内容类型。 |
| 400 | UPSTREAM_TOO_LARGE | 网页大于 5 MiB。 |
| 400 | INVALID_PARAMS | 网站的 TLS 证书无法验证(每次请求都会检查)。消息中会给出主机名。 |
| 401 | UNAUTHORIZED | 缺少 x-api-key 请求头,或密钥已吊销或未知。 |
| 402 | INSUFFICIENT_CREDITS | 积分不足以支付本次调用。请在控制台选择套餐或充值。 |
| 404 | NOT_FOUND | 网站不存在或拒绝连接:域名无法解析,或没有服务接受连接。消息中会给出主机名。 |
| 429 | MARKETPLACE_SATURATED | 并发调用过多。请等待 Retry-After 秒后重试。 |
| 503 | UPSTREAM_UNAVAILABLE | 每次尝试网页都停留在机器人验证。请稍后重试。 |
全部错误代码见 Errors。失败的调用不计费。
价格
价格 每次调用 1 积分。套餐与积分
说明
status属于网站。404或500页面会像其他页面一样被读取、返回并计费。使用markdown前请先检查status。- 不执行 JavaScript。 按网站服务器发送的内容读取页面。只靠 JavaScript 填充内容的页面,返回的文本会很少甚至没有
(
wordCount很低);服务器发送的内容可用include=html查看。 - 只取正文。
markdown不含导航、页眉、页脚和侧栏。部分页面(尤其是商品页)可能残留少量周边内容(相关商品列表、按钮文字)。include=html会同时返回整个页面。 maxChars在上限附近有段落分隔时于该处截断markdown,并设置truncated: true。wordCount仍统计整个正文。使用include=text时,text也按同样方式截断。include=text,links,images返回正文的纯文本、正文中的链接({ url, text })和图片({ url, alt }), 地址均为绝对地址,每个地址一次,按页面顺序。它们与markdown读自同一正文,因此导航栏或页脚中的链接不在其中。- 纯文本页面(
text/plain)在markdown中返回其文本,title为空字符串。 - 自动跟随重定向,
finalUrl为作出响应的地址。每种类型的字段见 Response Schema。