2024-12-07 03:53:46 -05:00
|
|
|
package extractor
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io"
|
|
|
|
)
|
|
|
|
|
2024-12-09 13:51:00 -05:00
|
|
|
type ScreenshotStyle string
|
|
|
|
|
|
|
|
const (
|
|
|
|
ScreenshotStyleFullPage ScreenshotStyle = "full"
|
|
|
|
ScreenshotStyleViewport ScreenshotStyle = "viewport"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ScreenshotOptions struct {
|
|
|
|
Style ScreenshotStyle
|
|
|
|
Width int
|
|
|
|
Height int
|
|
|
|
}
|
|
|
|
|
2024-12-07 03:53:46 -05:00
|
|
|
type Browser interface {
|
|
|
|
io.Closer
|
|
|
|
|
|
|
|
Open(ctx context.Context, url string) (Source, error)
|
2024-12-09 13:51:00 -05:00
|
|
|
Screenshot(ctx context.Context, url string, opts ScreenshotOptions) ([]byte, error)
|
|
|
|
OpenAndScreenshot(ctx context.Context, url string, opts ScreenshotOptions) (Source, []byte, error)
|
2024-12-07 03:53:46 -05:00
|
|
|
}
|