go-extractor/browser.go

28 lines
554 B
Go

package extractor
import (
"context"
"io"
)
type ScreenshotStyle string
const (
ScreenshotStyleFullPage ScreenshotStyle = "full"
ScreenshotStyleViewport ScreenshotStyle = "viewport"
)
type ScreenshotOptions struct {
Style ScreenshotStyle
Width int
Height int
}
type Browser interface {
io.Closer
Open(ctx context.Context, url string) (Source, error)
Screenshot(ctx context.Context, url string, opts ScreenshotOptions) ([]byte, error)
OpenAndScreenshot(ctx context.Context, url string, opts ScreenshotOptions) (Source, []byte, error)
}