npm.io
1.1.0 • Published 2 weeks ago

webscreenshot-io

Licence
ISC
Version
1.1.0
Deps
1
Size
4 kB
Vulns
0
Weekly
0
Stars
2

WebScreenshot.io Screenshot API

Generate screenshots of web pages using the WebScreenshot.io API. Perfect for generating thumbnails of web pages, or for generating screenshots of web pages for use in your own applications.

Sign up for an API key and secret at WebScreenshot.io.

Installation

npm install webscreenshot-io

Requires Node.js 18 or newer. TypeScript types are included.

Node.js Usage Example

import Webscreenshot from 'webscreenshot-io';
// or: const Webscreenshot = require('webscreenshot-io');

// API key and secret from webscreenshot.io
const webscreenshot = Webscreenshot(API_KEY, API_SECRET);

// Available options: https://webscreenshot.io/documentation/options/options/
const options = {
  page: 'google.com',
  height: 600,
  width: 800,
  format: 'jpeg'
}

const imageUrl = webscreenshot.screenshotUrl(options);
console.log(imageUrl);

The secret signs each URL so nobody can reuse your key with different options. Keep it server-side. Passing only the API key (Webscreenshot(API_KEY)) builds unsigned URLs.

Keywords