{"id":30876152,"url":"https://github.com/ryanuo/screenshot","last_synced_at":"2025-09-08T02:06:48.139Z","repository":{"id":312668416,"uuid":"1048209046","full_name":"ryanuo/screenshot","owner":"ryanuo","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-01T08:06:32.000Z","size":79,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-01T09:59:00.147Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://screenshot-xi-nine.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanuo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-01T05:22:32.000Z","updated_at":"2025-09-01T08:06:35.000Z","dependencies_parsed_at":"2025-09-01T09:59:02.174Z","dependency_job_id":"20c9e96d-55fc-4805-b130-411ddde85684","html_url":"https://github.com/ryanuo/screenshot","commit_stats":null,"previous_names":["ryanuo/screenshot"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ryanuo/screenshot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanuo%2Fscreenshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanuo%2Fscreenshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanuo%2Fscreenshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanuo%2Fscreenshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanuo","download_url":"https://codeload.github.com/ryanuo/screenshot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanuo%2Fscreenshot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274121957,"owners_count":25225801,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-08T02:06:45.008Z","updated_at":"2025-09-08T02:06:48.127Z","avatar_url":"https://github.com/ryanuo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vercel Screenshot\n\n一个基于 Puppeteer 或 Playwright 的无服务器 API，用于捕获网站截图。\n\n## 简介\n\n本项目源自 [RemiixInc/screenshot](https://github.com/RemiixInc/screenshot)，经过修改和更新，采用了新的截图包，目前可基于 Puppeteer 或 Playwright 实现网站截图功能，支持部署到 Vercel 或 Netlify 等平台。\n\n## 技术栈\n\n- **核心依赖**：\n  - `puppeteer-core`：无头浏览器工具，用于网页截图\n  - `playwright-core`：另一个无头浏览器工具，可替代 Puppeteer 使用\n  - `@sparticuz/chromium`：适用于 serverless 环境的 Chromium 浏览器\n\n## 部署指南\n\n### Vercel 部署\n\n1. 克隆或 Fork 本仓库到你的代码库\n2. 在 Vercel 中导入该仓库\n3. 系统会自动使用 `vercel.json` 中的配置（最大运行时长 60 秒）\n4. 部署完成后即可使用\n\n### Netlify 部署\n\n1. 克隆或 Fork 本仓库到你的代码库\n2. 在 Netlify 中导入该仓库\n3. 系统会自动读取 `netlify.toml` 配置：\n   - 函数超时时间：26 秒\n   - 内存限制：1.5GB（因 Puppeteer 较耗内存）\n   - 自动重定向 `/api/*` 到对应函数\n\n## 使用方法\n\n### API 端点\n\n部署后，API 端点为：\n```\nhttps://\u003c你的部署域名\u003e/api\n```\n\n### 参数说明\n\n| 参数名 | 类型 | 说明 | 默认值 |\n|--------|------|------|--------|\n| `url` | string | 必需，要截图的网站 URL（需包含 http/https） | - |\n| `width` | number | 截图宽度 | 1280 |\n| `height` | number | 截图高度 | 720 |\n| `returnType` | string | 返回类型，`buffer` 直接返回图片，`json` 返回 OSS 存储地址 | `buffer` |\n\n### 示例\n\n```\nhttps://\u003c你的部署域名\u003e/api?url=https://google.com\u0026width=1280\u0026height=720\n```\n\n## 切换截图工具\n\n默认使用 Puppeteer，若要切换为 Playwright：\n\n1. 在 `api/index.ts` 中注释掉 Puppeteer 导入\n2. 取消注释 Playwright 导入：\n   ```typescript\n   // import { getScreenshot } from '../lib/puppeteer'\n   import { getScreenshot } from '../lib/playwright'\n   ```\n\n## 许可证\n\n本项目基于 MIT 许可证开源，详见 [LICENSE](LICENSE) 文件。\n\n版权所有 © 2025 Ryanuo，© 2024 Adam Bukowski，© 2021 RemiixInc\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanuo%2Fscreenshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanuo%2Fscreenshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanuo%2Fscreenshot/lists"}