HTML to Markdown API
输入公开网页地址,获取 Markdown 内容。
接口
GET https://api.goanyapi.com/api/v1/html-to-markdown-api参数
| 参数 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
url | Query | string | 是 | 公开的 HTTP 或 HTTPS 网页地址,例如 https://example.com。 |
retainImages | Query | all | alt | none | 否 | 图片处理:保留图片、只保留替代文字或移除图片。默认 all。 |
retainLinks | Query | all | text | none | 否 | 链接处理:保留链接、只保留链接文字或移除链接。默认 all。 |
targetSelector | Query | string | 否 | 要提取的页面区域的 CSS 选择器,例如 article。 |
请求示例
GET /api/v1/html-to-markdown-api?url=https%3A%2F%2Fexample.com&retainImages=alt&retainLinks=all
Authorization: Bearer YOUR_API_KEY计费
当前配置下,每次成功请求消耗 1 积分。
API Tester 对 https://google.com 直接展示预存的 JSON,不发起请求,也不扣积分。直接调用接口请求该地址同样免费。其他地址转换成功后按当前配置扣除积分;转换失败不扣积分。
响应
| 字段 | 类型 | 说明 |
|---|---|---|
data.url | string | 转换后的网页地址。 |
data.title | string | 网页标题;不可用时为空字符串。 |
data.description | string | 网页描述;不可用时为空字符串。 |
data.markdown | string | 转换得到的 Markdown 正文。 |
data.creditsUsed | number | 本次实际扣除的积分。 |
data.remainingCredits | number | 请求后的剩余积分。 |
响应数据示例(Google Demo,剩余积分为示例值):
{
"code": "ok",
"message": "ok",
"data": {
"url": "https://google.com/",
"title": "Google",
"description": "",
"markdown": "[About](https://about.google/?fg=1&utm_source=google-US&utm_medium=referral&utm_campaign=hp-header)[Store](https://store.google.com/US?utm_source=hp_header&utm_medium=google_ooo&utm_campaign=GS100042&hl=en-US)\n\n[Gmail](https://mail.google.com/mail/&ogbl)\n\n[Images](https://www.google.com/imghp?hl=en&ogbl)\n\n[](https://www.google.com/intl/en/about/products)\n\n[Sign in](https://accounts.google.com/ServiceLogin?hl=en&passive=true&continue=https://www.google.com/&ec=futura_exp_og_so_72776762_e)\n\n[](https://www.google.com/webhp?hl=en&ictx=0&sa=X&ved=0ahUKEwjC-9bflsWXAxU4IDQIHY92EskQPAgF)\n\nWhat's on your mind?\n\n* Add images\n* Add files\n* 🍌Create images Canvas \n\nAI Mode\n\n🍌Create Remove Create Images Canvas Remove Canvas\n\nChoose what youre giving feedback on\n\n*   * * *\n\nSee more Delete \n*   \n* \n\nReport inappropriate predictions\n\nI'm Feeling Curious\n\nI'm Feeling Hungry\n\nI'm Feeling Adventurous\n\nI'm Feeling Playful\n\nI'm Feeling Stellar\n\nI'm Feeling Doodley\n\nI'm Feeling Trendy\n\nI'm Feeling Artistic\n\nI'm Feeling Funny\n\nI'm Feeling Mindful\n\n[Advertising](https://www.google.com/intl/en_us/ads/?subid=ww-ww-et-g-awa-a-g_hpafoot1_1!o2&utm_source=google.com&utm_medium=referral&utm_campaign=google_hpafooter&fg=1)[Business](https://www.google.com/services/?subid=ww-ww-et-g-awa-a-g_hpbfoot1_1!o2&utm_source=google.com&utm_medium=referral&utm_campaign=google_hpbfooter&fg=1)[How Search works](https://google.com/search/howsearchworks/?fg=1)\n\n[Build, create, and do more with AI tools from Google](https://ai.google/helpful-tools/?utm_source=googlehpfooter&utm_medium=housepromos&utm_campaign=bottom-footer)\n\n[Privacy](https://policies.google.com/privacy?hl=en&fg=1)[Terms](https://policies.google.com/terms?hl=en&fg=1)\n\nSettings\n\n[Search settings](https://www.google.com/preferences?hl=en&fg=1)\n\n[Advanced search](https://google.com/advanced_search?hl=en&fg=1)\n\n[Your data in Search](https://google.com/history/privacyadvisor/search/unauth?utm_source=googlemenu&fg=1&cctld=com)\n\n[Search history](https://google.com/history/optout?hl=en&fg=1)\n\n[Search help](https://support.google.com/websearch/?p=ws_results_help&hl=en&fg=1)\n\nSend feedback\n\nDark theme: Off\n\nGoogle apps",
"creditsUsed": 0,
"remainingCredits": 466865
}
}