这个 API 服务可以获取任何网页的截图,并以图片链接的形式返回图片数据。
端点: /tool/screenshot
参数名 | 类型 | 必填 | 默认值 | 描述 |
---|---|---|---|---|
url | string | 是 | - | 要截图的网站 URL |
width | number | 否 | 1920 | 视口宽度(像素) |
height | number | 否 | 950 | 视口高度(像素) |
fullPage | boolean | 否 | false | 是否截取完整页面 |
quality | number | 否 | 60 | JPEG 质量 (1-100) |
timeout | number | 否 | 60000 | 超时时间(毫秒) |
wait_for_selector | string | 否 | - | 等待特定元素出现后再截图(CSS 选择器)。超时则截图当前页面状态 |
wait_time | number | 否 | 2000 | 额外等待时间(毫秒), 额外等待html渲染时间 |
curl -X POST http://localhost:5000/tool/url_screenshot -H "Content-Type: application/json" -d '{
"url": "https://www.example.com",
"width": 1024,
"height": 768,
"fullPage": true,
"quality": 90
}'
http://localhost:5000/tool/url_screenshot?url=https://www.example.com&width=1024&height=768&fullPage=true&quality=90
{
"success": true,
"imageUrl": "https://files.thinkwriter.ai/file/screenshot/xxxxxx.jpeg",
"message": "Screenshot taken successfully"
}
正在截图,请稍候...