chrome

package
v0.0.0-...-9debd8d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHTMLTitle

func GetHTMLTitle(r io.Reader) (string, bool)

GetHTMLTitle will parse the Title from an HTML document ref:

https://siongui.github.io/2016/05/10/go-get-html-title-via-net-html/

Types

type Chrome

type Chrome struct {
	ResolutionX int
	ResolutionY int
	UserAgent   string
	Timeout     int64
	Delay       int
	FullPage    bool
	ChromePath  string
	Proxy       string
}

Chrome contains information about a Google Chrome instance, with methods to run on it.

func NewChrome

func NewChrome() *Chrome

NewChrome returns a new initialised Chrome struct

func (*Chrome) Preflight

func (chrome *Chrome) Preflight(url *url.URL) (resp *http.Response, title string, err error)

Preflight will preflight a url

func (*Chrome) Screenshot

func (chrome *Chrome) Screenshot(url *url.URL) ([]byte, error)

Screenshot takes a screenshot of a URL and saves it to destination Ref:

https://github.com/chromedp/examples/blob/255873ca0d76b00e0af8a951a689df3eb4f224c3/screenshot/main.go

func (*Chrome) StorePreflight

func (chrome *Chrome) StorePreflight(url *url.URL, db *gorm.DB, resp *http.Response, title string, filename string) (uint, error)

StorePreflight will store preflight info to a DB

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL