{"id":13447030,"url":"https://github.com/sindresorhus/capture-website-cli","last_synced_at":"2025-05-15T15:09:13.377Z","repository":{"id":34082744,"uuid":"169629499","full_name":"sindresorhus/capture-website-cli","owner":"sindresorhus","description":"Capture screenshots of websites from the command-line","archived":false,"fork":false,"pushed_at":"2023-11-06T10:33:10.000Z","size":56,"stargazers_count":821,"open_issues_count":13,"forks_count":42,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-29T17:12:32.215Z","etag":null,"topics":["capture-screenshots","cli-app","nodejs","npm-package","puppeteer","screenshots","website-screenshot","website-screenshot-capturer"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/sindresorhus.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},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2019-02-07T19:29:44.000Z","updated_at":"2024-10-26T16:46:05.000Z","dependencies_parsed_at":"2023-12-21T05:36:39.192Z","dependency_job_id":"4a753ab3-8b63-4be9-99c6-64a4189c7e50","html_url":"https://github.com/sindresorhus/capture-website-cli","commit_stats":{"total_commits":52,"total_committers":9,"mean_commits":5.777777777777778,"dds":"0.23076923076923073","last_synced_commit":"8b46e3fab4109ccb76911ec844db199c9021dc6b"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fcapture-website-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fcapture-website-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fcapture-website-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fcapture-website-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/capture-website-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247558674,"owners_count":20958201,"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":["capture-screenshots","cli-app","nodejs","npm-package","puppeteer","screenshots","website-screenshot","website-screenshot-capturer"],"created_at":"2024-07-31T05:01:06.351Z","updated_at":"2025-04-07T22:03:42.569Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","readme":"# capture-website-cli\n\n\u003e Capture screenshots of websites from the command-line\n\nIt uses [Puppeteer](https://github.com/GoogleChrome/puppeteer) (Chrome) under the hood.\n\n## Install\n\n```sh\nnpm install --global capture-website-cli\n```\n\nNote to Linux users: If you get a \"No usable sandbox!\" error, you need to enable [system sandboxing](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#setting-up-chrome-linux-sandbox).\n\n## Usage\n\n```\n$ capture-website --help\n\n  Usage\n    $ capture-website \u003curl|file\u003e\n    $ echo \"\u003ch1\u003eUnicorn\u003c/h1\u003e\" | capture-website\n\n  Options\n    --output                 Image file path (writes it to stdout if omitted)\n    --width                  Page width  [default: 1280]\n    --height                 Page height  [default: 800]\n    --type                   Image type: png|jpeg|webp  [default: png]\n    --quality                Image quality: 0...1 (Only for JPEG and WebP)  [default: 1]\n    --scale-factor           Scale the webpage `n` times  [default: 2]\n    --list-devices           Output a list of supported devices to emulate\n    --emulate-device         Capture as if it were captured on the given device\n    --full-page              Capture the full scrollable page, not just the viewport\n    --no-default-background  Make the default background transparent\n    --timeout                Seconds before giving up trying to load the page. Specify `0` to disable.  [default: 60]\n    --delay                  Seconds to wait after the page finished loading before capturing the screenshot  [default: 0]\n    --wait-for-element       Wait for a DOM element matching the CSS selector to appear in the page and to be visible before capturing the screenshot\n    --element                Capture the DOM element matching the CSS selector. It will wait for the element to appear in the page and to be visible.\n    --hide-elements          Hide DOM elements matching the CSS selector (Can be set multiple times)\n    --remove-elements        Remove DOM elements matching the CSS selector (Can be set multiple times)\n    --click-element          Click the DOM element matching the CSS selector\n    --scroll-to-element      Scroll to the DOM element matching the CSS selector\n    --disable-animations     Disable CSS animations and transitions  [default: false]\n    --no-javascript          Disable JavaScript execution (does not affect --module/--script)\n    --module                 Inject a JavaScript module into the page. Can be inline code, absolute URL, and local file path with `.js` extension. (Can be set multiple times)\n    --script                 Same as `--module`, but instead injects the code as a classic script\n    --style                  Inject CSS styles into the page. Can be inline code, absolute URL, and local file path with `.css` extension. (Can be set multiple times)\n    --header                 Set a custom HTTP header (Can be set multiple times)\n    --user-agent             Set the user agent\n    --cookie                 Set a cookie (Can be set multiple times)\n    --authentication         Credentials for HTTP authentication\n    --debug                  Show the browser window to see what it's doing\n    --dark-mode              Emulate preference of dark color scheme\n    --launch-options         Puppeteer launch options as JSON\n    --overwrite              Overwrite the destination file if it exists\n    --inset                  Inset the screenshot relative to the viewport or \\`--element\\`. Accepts a number or four comma-separated numbers for top, right, left, and bottom.\n    --clip                   Position and size in the website (clipping region). Accepts comma-separated numbers for x, y, width, and height.\n    --no-block-ads           Disable ad blocking\n\n  Examples\n    $ capture-website https://sindresorhus.com --output=screenshot.png\n    $ capture-website index.html --output=screenshot.png\n    $ echo \"\u003ch1\u003eUnicorn\u003c/h1\u003e\" | capture-website --output=screenshot.png\n    $ capture-website https://sindresorhus.com | open -f -a Preview\n\n  Flag examples\n    --width=1000\n    --height=600\n    --type=jpeg\n    --quality=0.5\n    --scale-factor=3\n    --emulate-device=\"iPhone X\"\n    --timeout=80\n    --delay=10\n    --wait-for-element=\"#header\"\n    --element=\".main-content\"\n    --hide-elements=\".sidebar\"\n    --remove-elements=\"img.ad\"\n    --click-element=\"button\"\n    --scroll-to-element=\"#map\"\n    --disable-animations\n    --no-javascript\n    --module=https://sindresorhus.com/remote-file.js\n    --module=local-file.js\n    --module=\"document.body.style.backgroundColor = 'red'\"\n    --header=\"x-powered-by: capture-website-cli\"\n    --user-agent=\"I love unicorns\"\n    --cookie=\"id=unicorn; Expires=Wed, 21 Oct 2018 07:28:00 GMT;\"\n    --authentication=\"username:password\"\n    --launch-options='{\"headless\": false}'\n    --dark-mode\n    --inset=10,15,-10,15\n    --inset=30\n    --clip=10,30,300,1024\n    --no-block-ads\n```\n\n## FAQ\n\n[More here.](https://github.com/sindresorhus/capture-website#faq)\n\n### How can I capture websites from a file with URLs?\n\nLets say you have a file named `urls.txt` with:\n\n```\nhttps://sindresorhus.com\nhttps://github.com\n```\n\nYou can run this:\n\n```sh\nfilename='urls.txt'\n\nwhile read url; do\n  capture-website \"$url\" --output \"screenshot-$(echo \"$url\" | sed -e 's/[^A-Za-z0-9._-]//g').png\"\ndone \u003c \"$filename\"\n```\n\n## Related\n\n- [capture-website](https://github.com/sindresorhus/capture-website) - API for this module\n- [pageres-cli](https://github.com/sindresorhus/pageres-cli) - A different take on screenshotting websites\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["JavaScript","nodejs","Packages"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fcapture-website-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fcapture-website-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fcapture-website-cli/lists"}