跳转到内容
POST AI agent ready /v1/html-to-text/convert

HTML 到文本 API - 免费 HTML 剥离器

去除所有 HTML 标签并返回纯文本。 标题、列表和表格将转换为可读的文本格式。 (可选)保留链接 URL 并设置自动换行列。

Parameters

stringrequired

The HTML content to convert.

boolean

Include link URLs in the plain text output (e.g., "Botoi [https://botoi.com]").

number

Wrap text at this column width. Set to 0 to disable wrapping.

Code examples

curl -X POST https://api.botoi.com/v1/html-to-text/convert \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Welcome</h1><p>Visit <a href=\"https://botoi.com\">Botoi</a>.</p>","preserveLinks":true,"wordwrap":80}'

When to use this API

生成 HTML 电子邮件的纯文本版本

为 HTML 营销或交易电子邮件创建文本/纯文本后备,以便它们在不支持 HTML 的客户端中呈现。

从网页中提取可读内容

抓取页面,将 HTML 传递到此端点,并获取干净的文本以进行内容分析、摘要或存档。

Frequently asked questions

HTML 表格是如何转换的?
表格转换为带间距的对齐纯文本列,保持数据可读,无需任何标记。
HTML 中的图像会发生什么情况?
如果可用,图像将替换为其替代文本。 如果不存在替代文本,则省略图像。
这可以处理格式错误的 HTML 吗?
是的。 该解析器具有宽容性,可以处理未封闭的标签、缺失的属性和其他常见的 HTML 问题。
为了安全起见,我可以使用它从用户输入中删除 HTML 吗?
对于安全清理,请改用 /v1/html-sanitize 端点。 该端点设计用于内容提取,而不是安全过滤。

Get your API key

Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.