Skip to content

wei/screenshotter

 
 

Repository files navigation

screenshotter

Serverless service that generates dynamic screenshots on demand.

Usage

parameter type description
url string Required
e.g. https://wikipedia.org
selector string css selector
e.g. .central-featured
viewport string viewport size
default: 1024,768
dpr integer device scale factor
default: 1
full boolean screenshot full page
default: (empty), set full=1 to enable
ua string user agent
e.g. Googlebot/2.1 (+http://www.google.com/bot.html)
css string custom css
e.g. body{background:lightyellow}
filetype string filetype
default: png, or jpeg

ℹ️ Don't forget to URL encode query string parameters

Examples

Latest Featured News

/screenshot
  ?url=https://yahoo.com
  &selector=[data-yaft-module=stream_item_1]>div

Sample Screenshot

Development

First, npm install && npm run build.

Option 1: Vercel

  1. Setup vercel project

    vercel
    
  2. Start development server

    vercel dev
    

Option 2: HTTP Server using micro

npm start

Option 3: Docker

docker-compose up

License

Packages

 
 
 

Languages

  • TypeScript 87.9%
  • Dockerfile 12.1%