Skip to content

Golang package for capturing screenshots of websites in various resolutions.

License

Notifications You must be signed in to change notification settings

slotix/pageres-go-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pageres Go Wrapper

Build Status Go Report Card

Golang package for capturing screenshots of websites in various resolutions. It uses Pageres https://github.com/sindresorhus/pageres-cli internally.

Installation

$ npm install --global pageres-cli
$ go get -u github.com/slotix/pageres-go-wrapper

Usage

package main
import (
    "fmt"
    "os"
	sshot "github.com/slotix/pageres-go-wrapper"
)

func main() {
    shotsDir := "shots"
    os.Mkdir(shotsDir, 0777)
	params := sshot.Parameters{
		Command: "pageres",
		Sizes:   "1024x768",
		Crop:    "--crop",
		Scale:   "--scale 0.9",
		Timeout: "--timeout 30",
		Filename:  fmt.Sprintf("--filename=%s/<%%= url %%>", shotsDir),
		UserAgent: "",
	}
	urls := []string{
		"http://google.com",
		"https://dbconvert.com",
		"http://something-that-doesnot-exists.com",
	}
	sshot.GetShots(urls, params)
	sshot.DeleteZeroLengthFiles(shotsDir)
}

Find more information about parameters at https://github.com/sindresorhus/pageres

About

Golang package for capturing screenshots of websites in various resolutions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages