Code Monkey home page Code Monkey logo

snappy's Introduction

logo

snappy

A website screenshot capture API created with Node & Express using Puppeteer as a headless Chromium browser to take and process screenshots. Credits to Pageres

Software License Typescript Made with Express Twitter

Overview

  • ๐Ÿ–ฅ๏ธ Control the size of the screenshot to take by pixels or device.
  • ๐Ÿ–ผ๏ธ Crop the screenshot to a set height from the top of the viewport.
  • ๐Ÿ™ˆ Hide a collection of DOM elements matching CSS selectors.
  • ๐ŸŽ›๏ธ Apply custom CSS & Javascript to the web page.
  • ๐Ÿ“ธ Many other settings including scale, user agent selection & dark mode.

Examples

  • Snap a URL with a size of 1920x1080
/snap?url=https://google.com&size=1920x1080
  • Snap a URL with the height set (crop) and serve the images fresh (no cache).
/snap?url=https://google.com&size=1920x1080&ignoreCache=true
  • Snap a URL and hide specific DOM elements (with a comma delimited list).
/snap?url=https://google.com?hide=h1,img
  • Snap a URL with a specific user agent.
/snap?url=https://google.com?userAgent=AdsBot-Google
  • Snap a URL and emulate preference of a dark color scheme.
/snap?url=https://google.com?darkMode: true

Options

Below are the options represented as query parameters you can pass to the /snap endpoint.

Query Key Default Required Description
url โœ… URL or local path of the website to screenshot.
size 1366x768 Size of the screenshot to take, this can be represented in pixels i.e. 1920x1080 or a device list.
ignoreCache false If the cache should be ignored when processing the screenshot.
rebuildCache false If the cache is to be rebuilt.
delay false Delay capturing the screenshot. Useful when the site does things after load that you want to capture.
crop true Crop to the set height.
css Apply custom CSS to the webpage.
script Apply custom JavaScript to the webpage.
selector Capture a specific DOM element matching a CSS selector.
hide Hide an array of DOM elements matching CSS selectors.
scale 1 Scale webpage n times.
userAgent 1 Custom user agent.
transparent false Set background color to transparent instead of white if no background is set.
darkMode false Emulate preference of dark color scheme.

snappy's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.