browsercapture

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultTileOverlap is the default pixel overlap between adjacent tiles.
	DefaultTileOverlap = 120
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	URL            string
	BrowserPath    string
	OutputPath     string
	OutputDir      string
	Selector       string
	CaptureHTML    bool
	CaptureText    bool
	FullPage       bool
	Tiles          bool
	Headless       bool
	NoSandbox      bool
	Width          int
	Height         int
	TileOverlap    int
	Scale          float64
	ScrollX        int
	ScrollY        int
	ScrollTo       string
	ScrollSelector string
	Timeout        time.Duration
	WaitAfterLoad  time.Duration
}

Options configures a browser capture run.

func PrepareOptions

func PrepareOptions(opts Options) (Options, error)

PrepareOptions normalizes capture options and fills defaults.

type Result

type Result struct {
	RequestedURL   string    `json:"requested_url"`
	FinalURL       string    `json:"final_url"`
	Title          string    `json:"title,omitempty"`
	CapturedAt     time.Time `json:"captured_at"`
	CaptureDir     string    `json:"capture_dir"`
	ScreenshotPath string    `json:"screenshot_path"`
	HTMLPath       string    `json:"html_path,omitempty"`
	TextPath       string    `json:"text_path,omitempty"`
	MetaPath       string    `json:"meta_path,omitempty"`
	Selector       string    `json:"selector,omitempty"`
	FullPage       bool      `json:"full_page"`
	Width          int       `json:"width"`
	Height         int       `json:"height"`
	Scale          float64   `json:"scale"`
	ScrollX        int       `json:"scroll_x"`
	ScrollY        int       `json:"scroll_y"`
	ScrollSelector string    `json:"scroll_selector,omitempty"`
	TilePaths      []string  `json:"tile_paths,omitempty"`
	TileCount      int       `json:"tile_count,omitempty"`
	TileOverlap    int       `json:"tile_overlap,omitempty"`
	TotalHeight    int       `json:"total_height,omitempty"`
}

Result describes the files written during a capture run.

func Capture

func Capture(opts Options) (Result, error)

Capture launches a browser, captures a screenshot, and optionally saves HTML and visible text sidecars.

Jump to

Keyboard shortcuts

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