{"id":18722003,"url":"https://github.com/realign/capture-web","last_synced_at":"2025-11-11T04:30:15.971Z","repository":{"id":124607387,"uuid":"202698740","full_name":"ReAlign/capture-web","owner":"ReAlign","description":"A tool, capture web page snapshot tobe png/jpeg/gif.","archived":false,"fork":false,"pushed_at":"2019-08-21T12:00:19.000Z","size":511,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-28T13:51:37.202Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ReAlign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2019-08-16T09:24:37.000Z","updated_at":"2021-07-17T15:47:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"b787648b-1fda-4e41-a625-2aaa8130d759","html_url":"https://github.com/ReAlign/capture-web","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReAlign%2Fcapture-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReAlign%2Fcapture-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReAlign%2Fcapture-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReAlign%2Fcapture-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ReAlign","download_url":"https://codeload.github.com/ReAlign/capture-web/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239587243,"owners_count":19663892,"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","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":"2024-11-07T13:39:17.258Z","updated_at":"2025-11-11T04:30:15.919Z","avatar_url":"https://github.com/ReAlign.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# capture-web\n\n\u003e A tool, capture web page snapshot tobe png/gif.\n\n[![NPM version][npm-image]][npm-url]\n\n## Effect\n\n### Goal\n\n* **two task**\n  * static:\n    * [🔗npm](https://www.npmjs.com/) homepage\n  * gif:\n    * search `node` in [🔗npm](https://www.npmjs.com/)\n\n[💻 Example](https://github.com/ReAlign/capture-web/tree/master/example/index.md) — 👇 `show-process`\n\n[![image/normal/2019-08-21/img-1566386341610-6930.gif](https://public-bucket-realign.nos-eastchina1.126.net/image/normal/2019-08-21/img-1566386341610-6930.gif)](https://public-bucket-realign.nos-eastchina1.126.net/image/normal/2019-08-21/img-1566386341610-6930.gif)\n\n### Result\n\n* [🔗npm](https://www.npmjs.com/) homepage\n  * [![image/normal/2019-08-21/img-1566387653454-1307.png](https://public-bucket-realign.nos-eastchina1.126.net/image/normal/2019-08-21/img-1566387653454-1307.png)](https://public-bucket-realign.nos-eastchina1.126.net/image/normal/2019-08-21/img-1566387653454-1307.png)\n* search `node` in [🔗npm](https://www.npmjs.com/)\n  * [![image/normal/2019-08-21/img-1566387659149-7621.gif](https://public-bucket-realign.nos-eastchina1.126.net/image/normal/2019-08-21/img-1566387659149-7621.gif)](https://public-bucket-realign.nos-eastchina1.126.net/image/normal/2019-08-21/img-1566387659149-7621.gif)\n\n***\n\n* Based on:\n  * [🔗puppeteer](https://github.com/GoogleChrome/puppeteer)\n  * [🔗capture-website](https://github.com/sindresorhus/capture-website)\n  * [🔗gifencoder](https://github.com/eugeneware/gifencoder)\n\n## Usage\n\n### install\n\n```bash\n# install\nnpm i @realign-zone/capture-web -S\n```\n\n### Task\n\n```js\nconst CaptureWeb = require('@realign-zone/capture-web');\n\n// configFilePath is：configFile's absolute path\nCaptureWeb(`${configFilePath}`).then(() =\u003e {\n    // do something after task done.\n});\n```\n\n## Config\n\nconfigFile\n\n```js\nmodule.exports = {\n    // 整体配置项\n    options: {\n        imgDir = '', // 保存图片文件目录 | 绝对路径\n        preName = '', // 图片文件名前缀 | 与后面的 name 拼接，构成完整 图片文件名称\n        preUrl = '', // 页面路径前缀 | 与后面的 pagePath 拼接，构成完整 路径\n    },\n    // 所有需要捕获的页面\n    pages: [\n        {\n            // 单个页面配置\n            item: {\n                name = '', // 当前页面名称\n                pagePath = '', // 当前页面路径\n                size = [1920, 1080], // 页面大小，若修改默认值：[Number, Number]\n            },\n            // 页面操作\n            // 每个对象是一帧\n            // 只有一个对象的话，就是 png，否则是 gif\n            step: [\n                {}, // 空对象，表示捕获页面截图\n                // 其他的，参考非第一帧的话，参考 https://github.com/sindresorhus/capture-website#api\n                {\n                    beforeScreenshot: async (page /*, browser*/ ) =\u003e {\n                        await page.type('#kw', 'github', {delay: 100});\n                    },\n                },\n            ],\n        },\n    ],\n};\n```\n\n## Todo\n\n* [ ] Performance optimization\n  * [ ] Too slow when capture gif\n* [ ] More config\n* [ ] Others\n\n[npm-image]: https://img.shields.io/npm/v/@realign-zone/capture-web.svg?longCache=true\u0026style=for-the-badge\n[npm-url]: https://www.npmjs.com/package/@realign-zone/capture-web\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealign%2Fcapture-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealign%2Fcapture-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealign%2Fcapture-web/lists"}