All Projects → elestio → ws-screenshot

elestio / ws-screenshot

Licence: MIT License
A simple way to take a screenshot of a website by providing its URL. ws-screenshot include a simple web UI but also a REST API and a Websocket API to automate screenshots.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects
Smarty
1635 projects
shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to ws-screenshot

nativescript-printer
📠 Send an image or the screen contents to a physical printer
Stars: ✭ 33 (+6.45%)
Mutual labels:  screenshot
screenshotgun
Open cross-platform screenshoter with cloud support and server part
Stars: ✭ 23 (-25.81%)
Mutual labels:  screenshot
twitch-chat-visualizer
A Node.js Project. Would you like to see your chat stream with a custom design? This is for you!
Stars: ✭ 14 (-54.84%)
Mutual labels:  screenshot
larafeed
Laravel package for providing visual feedback via screenshots.
Stars: ✭ 42 (+35.48%)
Mutual labels:  screenshot
awesome-www
Website of AwesomeWM
Stars: ✭ 39 (+25.81%)
Mutual labels:  screenshot
broz
A simple, frameless browser for screenshots
Stars: ✭ 265 (+754.84%)
Mutual labels:  screenshot
scr
🎤 A Super CRappy SCReenshot & SCreen Recording SCRipt for Sound Cloud Rappers + audio recorder, yes (sponsored by https://git.io/kiwmi)
Stars: ✭ 16 (-48.39%)
Mutual labels:  screenshot
snapcrawl
Crawl a website and take screenshots
Stars: ✭ 37 (+19.35%)
Mutual labels:  screenshot
gpp-decrypt
Tool to parse the Group Policy Preferences XML file which extracts the username and decrypts the cpassword attribute.
Stars: ✭ 13 (-58.06%)
Mutual labels:  screenshot
screenshot-node
Takes a screenshot of selected area and saves it to disk
Stars: ✭ 20 (-35.48%)
Mutual labels:  screenshot
SteaScree
SteaScree: Steam Cloud Screenshot Uploader
Stars: ✭ 140 (+351.61%)
Mutual labels:  screenshot
godot-engine.code-snapshot
A plugin for Godot Engine which will let you take beautified snapshots of your code within the Editor. Configure the frame as you like, with GDScript syntax already highlighted.
Stars: ✭ 32 (+3.23%)
Mutual labels:  screenshot
ArcoLinux-dotfiles
ArcoLinux dotfiles for 2bwm / i3wm
Stars: ✭ 24 (-22.58%)
Mutual labels:  screenshot
colorstorm
A color theme generator for editors and terminal emulators
Stars: ✭ 101 (+225.81%)
Mutual labels:  screenshot
Jamscreenshot
一个用python实现的类似微信QQ截屏的工具源码,整合提取自本人自制工具集Jamtools
Stars: ✭ 23 (-25.81%)
Mutual labels:  screenshot
vrt-react
Take a screenshot 📸 of React component. Push it and compare images in pull request.
Stars: ✭ 19 (-38.71%)
Mutual labels:  screenshot
EasyToast
Swift Toasts Library
Stars: ✭ 20 (-35.48%)
Mutual labels:  screenshot
screenshot-actions
Dunst actions for screenshots (OCR, upload to 0x0.st, delete, rename, move to/from clipboard)
Stars: ✭ 49 (+58.06%)
Mutual labels:  screenshot
TakingImageOfAView
An example on how to take screenshot of a particular view
Stars: ✭ 15 (-51.61%)
Mutual labels:  screenshot
urlbox-screenshots-node
Capture website thumbnails using the urlbox.io screenshot as a service API in node
Stars: ✭ 14 (-54.84%)
Mutual labels:  screenshot

ws-screenshot

A simple way to take a screenshot of a website by providing its URL. ws-screenshot include a simple web UI but also a REST API and a Websocket API to automate screenshots.

DEMO: https://backup15.terasp.net/

 

Quickstart with Docker

Run once:

docker pull elestio/ws-screenshot.slim
docker run -p 3000:3000 -it elestio/ws-screenshot.slim

or Run as a docker service:

docker run --name ws-screenshot -d --restart always -p 3000:3000 -it elestio/ws-screenshot.slim

Then open http://yourIP:3000/ in your browser

 

Requirements

  • Linux, Windows or Mac OS
  • Node 12+

Install Node.js 16

sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt -y install nodejs

Clone this repository

Clone this repo then install NPM dependencies for ws-screenshot:

git clone [email protected]:elestio/ws-screenshot.git
cd ws-screenshot
npm install

Install required dependencies for chrome:

./installPuppeteerNativeDeps.sh

 

Run ws-screenshot

Run directly

Finally we can start WS-SCREENSHOT Server one-time:

./run.sh

or run as a service with pm2

npm install -g pm2
pm2 start run.sh --name ws-screenshot
pm2 save

Run with docker (local version for dev)

Run just once

docker build -t ws-screenshot .
docker run --rm -p 3000:3000 -it ws-screenshot

Run as a docker service

docker run --name ws-screenshot -d --restart always -p 3000:3000 -it ws-screenshot

Run on Kubernetes

Run with helm

helm upgrade --install ws-screenshot --namespace ws-screenshot helm/

Run with proxy

Add PROXY_SERVER env variable:

docker run --rm -p 3000:3000 --env PROXY_SERVER=socks5://host:port -it ws-screenshot

NOTE: Chromium ignores username and password in --proxy-server arg

https://bugs.chromium.org/p/chromium/issues/detail?id=615947

 

Usage

REST API

Make a GET request (or open the url in your browser):

/api/screenshot?resX=1280&resY=900&outFormat=jpg&isFullPage=false&url=https://vms2.terasp.net

Websocket API

var event = {
  cmd: "screenshot",
  url: url,
  originalTS: (+new Date()),
  resX: resX,
  resY: resY,
  outFormat: outFormat,
  isFullPage: isFullPage
};

You can check /public/js/client.js and /public/index.html for a sample on how to call the Websocket API

 

Supported parameters

  • url: full url to screenshot, must start with http:// or https://
  • resX: integer value for screen width, default: 1280
  • resY: integer value for screen height, default: 900
  • outFormat: output format, can be jpg, png or pdf, default: jpg
  • isFullPage: true or false, indicate if we should scroll the page and make a full page screenshot, default: false
  • waitTime: integer value in milliseconds, indicate max time to wait for page resources to load, default: 100

 

Protect with an ApiKey

You can protect the REST & WS APIs with an ApiKey, this is usefull if you want to protect your screenshot server from being used by anyone To do that, open appconfig.json and set any string like a GUID in ApiKey attribute. This will be your ApiKey to pass to REST & WS APIs

To call the REST API with an ApiKey:

/api/screenshot?url=https://example.com&apiKey=XXXXXXXXXXXXX

To call the Websocket API with an ApiKey:

var event = {
  cmd: "screenshot",
  url: url,
  originalTS: (+new Date()),
  apiKey: "XXXXXXXXXXXXX"
};

You can check /public/js/client.js for a sample on how to call the Websocket API

TODO list

  • Add support for cookies / localstorage auth (to be able to screenshot authenticated pages)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].