接口描述: 传入目标网页 URL 及渲染参数,接口将直接返回生成的截图图片流(Content-Type: image/png)。
所有接口均需在 HTTP Header 中携带 Bearer Token 进行鉴权:
API Token 可在 字根秀秀后台 申请。
支持 application/json 或 application/x-www-form-urlencoded 格式提交数据。
| 参数名 | 类型 | 是否必填 | 说明与枚举值 |
|---|---|---|---|
url | String | 是 | 目标网址,必须以 https:// 开头。例如:https://www.google.com |
screenshot_mode | String | 否 | 截图方式。 - viewport: (默认) 仅截取首屏可见区域- fullpage: 截取整个网页长图 |
device_type | String | 否 | 模拟设备类型,决定浏览器视口分辨率。 - desktop: (默认) 桌面端,1920x1080- tablet: 平板端,768x1024- mobile: 手机端,375x812- custom: 自定义尺寸 |
custom_x | Integer | 否 | 自定义视口宽度(仅当 device_type=custom 时有效,最小值 100) |
custom_y | Integer | 否 | 自定义视口高度(仅当 device_type=custom 时有效,最小值 100) |
以下示例使用 cURL 请求 API,并将返回的二进制图片流保存为 output.png: