Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/appliedsoul/headless-screenshot
High-level library for taking screenshot of websites based on headless chrome (puppeteer)
https://github.com/appliedsoul/headless-screenshot
crawler headless-chromium javascript nodejs scrapper screenshot testing
Last synced: 26 days ago
JSON representation
High-level library for taking screenshot of websites based on headless chrome (puppeteer)
- Host: GitHub
- URL: https://github.com/appliedsoul/headless-screenshot
- Owner: AppliedSoul
- Created: 2018-08-23T00:32:52.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-02T09:07:09.000Z (over 4 years ago)
- Last Synced: 2024-10-12T09:04:24.845Z (26 days ago)
- Topics: crawler, headless-chromium, javascript, nodejs, scrapper, screenshot, testing
- Language: JavaScript
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# headless-screenshot
[![npm package](https://nodei.co/npm/headless-screenshot.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/headless-screenshot/)
[![Build Status](https://travis-ci.org/AppliedSoul/headless-screenshot.svg?branch=master)](https://travis-ci.org/AppliedSoul/headless-screenshot) [![Coverage Status](https://coveralls.io/repos/github/AppliedSoul/headless-screenshot/badge.svg?branch=master)](https://coveralls.io/github/AppliedSoul/crawlmatic?branch=master) [![Greenkeeper badge](https://badges.greenkeeper.io/AppliedSoul/headless-screenshot.svg)](https://greenkeeper.io/)
headless-screenshot is a high-level on top of headless embedded chromium browser (puppeteer). It provides safe & easy to use interface for taking screenshot of websites.
Built with :heart:
## Install
headless-screenshot depends on puppeteer, ensure its installed globally or locally before using this library.
```
npm i puppeteer headless-screenshot
```Usage:
```javascript
const HeadShot = require('headless-screenshot');
const Promise = require('bluebird');
const writeFile = Promise.promisify(require('fs').writeFile);let hc = new HeadShot() // browser instance
hc.setup() // launches embedded chromium instance
.then(() =>
hc.getScreenshot('https://example.com')
.then( res => {
console.log(`resolvedUrl: ${res.resolvedUrl}, originalUrl: ${res.url}, isReachable: ${res.isReachable}`);
writeFile('./example.png',res.data).then(() => console.log('file is written'));
}).finally(() => hc.destroy())
```For reference look at test cases.