Documentation
¶
Index ¶
- type As
- type Byte
- type Cookie
- type Files
- type HAR
- type LocalStorage
- type Path
- type ScreenshotOption
- func AppendToFile(f Files) ScreenshotOption
- func Cookies(cookies []Cookie) ScreenshotOption
- func DumpHAR(b bool) ScreenshotOption
- func Format(format string) ScreenshotOption
- func Height(height int64) ScreenshotOption
- func MaxHeight(height int64) ScreenshotOption
- func MaxWidth(width int64) ScreenshotOption
- func Mobile(b bool) ScreenshotOption
- func PrintPDF(b bool) ScreenshotOption
- func Quality(quality int64) ScreenshotOption
- func RawHTML(b bool) ScreenshotOption
- func ScaleFactor(factor float64) ScreenshotOption
- func Storage(storage []LocalStorage) ScreenshotOption
- func Width(width int64) ScreenshotOption
- type ScreenshotOptions
- type Screenshoter
- type Screenshots
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cookie ¶ added in v1.4.0
type Cookie struct { Name string `yaml:"name"` // Cookie name. Value string `yaml:"value"` // Cookie value. Domain string `yaml:"domain"` // Cookie domain. Path string `yaml:"path,omitempty"` // Cookie path. Expires time.Time `yaml:"expires,omitempty"` // Cookie expiration date, session cookie if not set Size int `yaml:"size,omitempty"` // Cookie size. HTTPOnly bool `yaml:"httpOnly,omitempty"` // True if cookie is http-only. Secure bool `yaml:"secure,omitempty"` // True if cookie is secure. SameSite string `yaml:"sameSite,omitempty"` // Cookie SameSite type. SameParty bool `yaml:"sameParty,omitempty"` // True if cookie is SameParty. Priority string `yaml:"priority,omitempty"` // Cookie Priority type. }
Cookie represents a cookie item.
func ImportCookies ¶ added in v1.4.0
ImportCookies imports cookies by given byte with yaml configuration. Format: cookies:
example.com: - name: 'foo' value: 'bar' - name: 'zoo' value: 'zoo' example.org: - name: 'foo' value: 'bar'
type LocalStorage ¶ added in v1.4.0
LocalStorage represents a local storage item.
func ImportStorage ¶ added in v1.4.0
func ImportStorage(r []byte) (storage []LocalStorage, err error)
type ScreenshotOption ¶
type ScreenshotOption func(*ScreenshotOptions)
func AppendToFile ¶ added in v1.6.0
func AppendToFile(f Files) ScreenshotOption
func Cookies ¶ added in v1.4.0
func Cookies(cookies []Cookie) ScreenshotOption
func DumpHAR ¶ added in v1.3.0
func DumpHAR(b bool) ScreenshotOption
func Format ¶
func Format(format string) ScreenshotOption
func Height ¶
func Height(height int64) ScreenshotOption
func MaxHeight ¶
func MaxHeight(height int64) ScreenshotOption
func MaxWidth ¶
func MaxWidth(width int64) ScreenshotOption
func Mobile ¶
func Mobile(b bool) ScreenshotOption
func PrintPDF ¶ added in v1.2.0
func PrintPDF(b bool) ScreenshotOption
func Quality ¶
func Quality(quality int64) ScreenshotOption
func RawHTML ¶ added in v1.2.0
func RawHTML(b bool) ScreenshotOption
func ScaleFactor ¶
func ScaleFactor(factor float64) ScreenshotOption
func Storage ¶ added in v1.4.0
func Storage(storage []LocalStorage) ScreenshotOption
func Width ¶
func Width(width int64) ScreenshotOption
type ScreenshotOptions ¶
type ScreenshotOptions struct { Width int64 Height int64 Mobile bool Format page.CaptureScreenshotFormat // jpg, png, default: png. Quality int64 MaxWidth int64 MaxHeight int64 ScaleFactor float64 PrintPDF bool RawHTML bool DumpHAR bool Files Files Cookies []Cookie Storage []LocalStorage }
ScreenshotOptions is the options used by Screenshot.
type Screenshoter ¶
type Screenshoter[T As] interface { Screenshot(ctx context.Context, input *url.URL, options ...ScreenshotOption) (*Screenshots[T], error) }
Screenshoter is a webpage screenshot interface.
func NewChromeRemoteScreenshoter ¶ added in v1.1.0
func NewChromeRemoteScreenshoter[T As](addr string) (res Screenshoter[T], err error)
NewChromeRemoteScreenshoter creates a Screenshoter backed by Chrome DevTools Protocol. The addr is the headless chrome websocket debugger endpoint, such as 127.0.0.1:9222.
type Screenshots ¶
type Screenshots[T As] struct { URL string Title string Image T HTML T PDF T HAR T // Total bytes of resources DataLength int64 }
func Screenshot ¶
func Screenshot[T As](ctx context.Context, input *url.URL, options ...ScreenshotOption) (*Screenshots[T], error)
Click to show internal directories.
Click to hide internal directories.