render

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package render provides the headless-rendering Fetcher backed by chromedp. It renders pages in a real Chromium tab, captures the post-JS DOM, records main-document redirects/status/headers via DevTools network events, and collects lab-mode Core Web Vitals (LCP, FCP, CLS, TBT, TTFB) using PerformanceObserver. On any rendering error the fetcher falls back to a raw HTTP fetch so a single broken page does not stall the crawl.

Headless mode requires a Chromium-class browser (Chrome, Chromium, or Edge) on PATH. NewHeadlessFetcher returns an error if no compatible browser can be launched.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HeadlessFetcher

type HeadlessFetcher struct {
	// contains filtered or unexported fields
}

HeadlessFetcher renders pages with chromedp and reports real Core Web Vitals.

func NewHeadlessFetcher

func NewHeadlessFetcher(opts crawler.Options) (*HeadlessFetcher, error)

NewHeadlessFetcher launches the headless browser. It returns an error if no Chromium binary is available on PATH or the browser fails to start. Callers must Close() the fetcher when finished.

func (*HeadlessFetcher) Close

func (h *HeadlessFetcher) Close() error

Close terminates the browser. Safe to call more than once.

func (*HeadlessFetcher) Fetch

func (h *HeadlessFetcher) Fetch(ctx context.Context, rawURL string) (*crawler.Page, error)

Fetch renders rawURL in a fresh tab. On rendering failure it falls back to a raw HTTP fetch and annotates the page's RenderResult with the failure reason.

Jump to

Keyboard shortcuts

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