render

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package render is the headless Chrome step: it finds the user's installed Chrome or Chromium. refetch never downloads a browser.

Index

Constants

View Source
const (
	OutcomeSkippedOff    = "skipped_off"     // render = "off"
	OutcomeSkippedByCall = "skipped_by_call" // fetch_page(render: false)
	OutcomeNoChrome      = "no_chrome"       // no Chrome or Chromium found
	OutcomeSkippedRoot   = "skipped_root"    // running as root, where Chrome's sandbox cannot run
)

Outcomes for a step 2 that was needed but did not run.

View Source
const Client = "headless"

Client is the attempt client name of the headless Chrome step.

View Source
const DefaultTimeout = 15 * time.Second

DefaultTimeout is render_timeout's default: Chrome start included.

Variables

View Source
var (
	ErrNoChrome = errors.New("no Chrome or Chromium found")
	ErrRoot     = errors.New("running as root: headless Chrome needs its sandbox, which does not run as root")
	ErrTimeout  = errors.New("headless Chrome timed out")
)

Errors Render returns.

Functions

func FindChrome

func FindChrome() string

FindChrome returns the Chrome to run: REFETCH_CHROME if set, then the macOS app paths (also under ~/Applications), then PATH. Empty means none.

func Name

func Name(ctx context.Context, chrome string) string

Name describes the installed Chrome for the stats header, like "Google Chrome 155"; "" when not found.

func Version

func Version(ctx context.Context, chrome string) string

Version is the installed Chrome's version ("155.0.8059.85"), or "" if it cannot be read within three seconds. It is cached per binary.

Types

type Renderer

type Renderer struct {
	Chrome  string        // binary; FindChrome() when empty
	Timeout time.Duration // hard cap, Chrome start included; DefaultTimeout when zero
	// contains filtered or unexported fields
}

Renderer runs the user's Chrome headless, behind a local proxy on the public-only dialer, and returns the DOM after the page's scripts ran.

func (*Renderer) Render

func (r *Renderer) Render(ctx context.Context, rawURL string) ([]byte, error)

Render loads rawURL in a throwaway headless Chrome profile and returns the serialized DOM (at most fetch.MaxBytes).

Jump to

Keyboard shortcuts

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