Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andreiigna/take-screenshots
📸 Take clean website screenshots
https://github.com/andreiigna/take-screenshots
chrome chromium javascript puppeteer screenshot
Last synced: about 1 month ago
JSON representation
📸 Take clean website screenshots
- Host: GitHub
- URL: https://github.com/andreiigna/take-screenshots
- Owner: AndreiIgna
- Created: 2018-12-30T19:11:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-19T00:49:18.000Z (over 1 year ago)
- Last Synced: 2024-09-29T17:02:56.827Z (about 2 months ago)
- Topics: chrome, chromium, javascript, puppeteer, screenshot
- Language: JavaScript
- Homepage:
- Size: 422 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 📸 take-screenshots
**take-screenshots** is a small NodeJS library than can take clean website screenshots, without any popups or cookie consent dialogs that may appear when browsing pages.
It uses [Puppeteer](https://github.com/GoogleChrome/puppeteer) with a set of optimal settings for loading pages & cleaning unwanted sections (any contributions for this are welcome).
## Highlights
* Beautiful screenshots.
* Zero-config, but configurable when needed.
* Uses custom instance of Puppeteer if needed.## Getting Started
#### Installation
To use in your project, run:
```npm i puppeteer take-screenshots```
> Note: `take-screenshots` requires Puppeteer to be installed in your project. It is a peer dependency so that the correct version or build is used on your platform.
#### Usage
The library has a simple API.**Example** - Take a screenshot of twitter.com and save it as `twitter.png`:
```js
const takeScreenshot = require('take-screenshots');(async () => {
await takeScreenshot('https://twitter.com', 'twitter.png');await takeScreenshot.closeBrowser();
})();
```Main function returns the image [buffer](https://nodejs.org/api/buffer.html), which you can manipulate or send forwards as a HTTP Response
**Example** - Take a screenshot of nyt.com and process the image:
```js
const takeScreenshot = require('take-screenshots');(async () => {
let img = await takeScreenshot('https://twitter.com', {viewport: {width: 800, height: 600}});// process the image, img is the image buffer
// sharp(img)// if using Express, image can be sent as response
// res.send(img)await takeScreenshot.closeBrowser();
})();
```## More
Please report any issues here on GitHub.
[Any contributions are welcome](CONTRIBUTING.md)## License
[MIT](http://opensource.org/licenses/MIT)
Copyright (c) Andrei Igna