lucified/screenshotter

Name: screenshotter

Owner: Lucify

Description: A Node server that takes screenshots of websites with pageres

Created: 2016-08-22 14:47:29.0

Updated: 2017-04-26 12:42:55.0

Pushed: 2017-05-15 11:41:42.0

Homepage:

Size: 41

Language: TypeScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Screenshotter

A Node server that takes screenshots of websites with pageres.

Install
install
Running
start # listens on port 8090 by default
Usage
POST /save

Saves screenshots of url with dimensions sizes to the directory dest in the server's local filesystem.

rface Payload {
l: string;
st: string;
zes?: string[]; // defaults to ["1024x768"]
ilOnWarnings?: boolean; // defaults to false
tions?: PageresOptions;

POST /stream

Streams a screenshot of url with dimensions size.

rface Payload {
l: string;
ze?: string; // defaults to "1024x768"
tions?: PageresOptions;

Pageres options and defaults
rface PageresOptions {
lay?: number;
meout?: number;
op?: boolean;
s?: string;
ript?: string;
okies?: string[];
lename?: string; // https://github.com/sindresorhus/pageres#filename
crementalName?: boolean;
lector?: string;
de?: string[];
ername?: string;
ssword?: string;
ale?: number; // 1
rmat?: 'png' | 'jpg'; // png
erAgent?: string;
aders?: object;


t defaultPageresOptions: PageresOptions = {
lay: 0,
meout: 30,
ale: 1,
rmat: 'png',
crementalName: false,
op: true,

Examples

Start the screenshotter at localhost:8090 with

er-compose up
Save to a directory
 -r -d '' BODY <<EOF

rl": "https://google.com",
est": "/screenshots",
izes": ["1024x768", "1920x1200"],
ptions": {
"scale": 2



 $BODY | curl -v -H "Content-Type: application/json" -d '@-' localhost:8090/save

There should now exist two PNGs at test/tmp.

Stream to a file
 -r -d '' BODY <<EOF

rl": "https://google.com",
ptions": {
"scale": 2



 $BODY | curl -v -H "Content-Type: application/json" -d '@-' localhost:8090/stream > screenshot.png
License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.