fetch

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch

func Fetch(url string, opts Options) ([]byte, error)

Fetch downloads a URL and returns its body as bytes.

func FetchWithBrowser

func FetchWithBrowser(url string, opts Options) ([]byte, error)

FetchWithBrowser uses a headless Chromium browser to fetch a URL, waiting for JavaScript to render the page before returning the HTML. Chromium is auto-downloaded to ~/.cache/rod/ on first use.

If the page contains iframes (e.g. HuggingFace Spaces, embedded apps), it captures iframe content and returns the richest HTML found.

Types

type Options

type Options struct {
	Headers   map[string]string
	Cookie    string
	Timeout   time.Duration
	JS        bool          // use headless browser for JS-rendered pages
	WaitExtra time.Duration // extra wait after page idle (for SPAs)
}

Options configures the HTTP fetcher.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns sensible fetch defaults.

Jump to

Keyboard shortcuts

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