Git Product home page Git Product logo

screenshot's Introduction

ScreenShot

A small HTTP server that takes a screenshot of a web page.

using Chromium to capture the screenshot and BBolt to cache images.

Install & Usage

  • Download
git clone https://github.com/twiny/screenshot
  • Install
go build -o bin/screenshot -v cmd/screen/main.go
  • Config app configuration
# port to start HTTP server.
port: "81"
# show chromium debug
debug: false
# http request rate limit: 1 req/sec and permits 2 bursts
rate: 1
bursts: 2
# how long images will be stored
image_cache: 10m
# paths
store: "data/app_store"
log: "data/app_log"
chrome_data: "data/chrome"
./bin/screenshot run -c "config.yaml"

Capture

  • HTTP POST /capture
{
    "url":"https://google.com",
}
  • Response example
{
    "Status": 200,
    "Payload": {
        "uuid": "c3b5ohg6n88rm0g59b30"
    }
}

Download

  • HTTP GET /download/{uuid}

if the image was captured successfully this will return the captured image.

in case there was an error capturing the images or the images is still pending captured, a message will be return instead of the emails

  • Response example
{
   "Status": 500,
   "Payload": "page load error net::ERR_NAME_NOT_RESOLVED"
}

or

{
   "Status": 500,
   "Payload": "screenshot not yet captured."
}

Stats

  • HTTP POST /stats

this will return general stats and resource usage.

  • Response example
{
    "Status": 200,
    "Payload": {
        "Limiter": {
            "total": 1
        },
        "Resources": {
            "CPUs": 4,
            "CompletedGC": 5,
            "GCSize": "4.47M",
            "Goroutine": 4,
            "StackSystem": "480K",
            "System": "70.83M"
        },
        "Store": {
            "fail": 0,
            "pending": 0,
            "success": 1
        }
    }
}

screenshot's People

Contributors

twiny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.