Documentation
¶
Overview ¶
Package jseval provides headless browser page rendering via chromedp. It navigates to a URL using a real Chrome/Chromium instance, waits for JavaScript to execute, and returns the fully rendered HTML DOM.
This complements the colly-based crawler package, which handles HTTP-only crawling. Use jseval for sites that require JavaScript execution (SPAs, Cloudflare challenges, etc.).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Timeout is the maximum time to wait for the page to render.
// Default: 30 seconds.
Timeout time.Duration
// WaitSelector is an optional CSS selector to wait for before extracting HTML.
// If empty, the renderer waits for Timeout or document idle, whichever comes first.
WaitSelector string
// ProxyURL is an optional HTTP/SOCKS proxy for the browser to use.
ProxyURL string
// UserAgent overrides the browser's default User-Agent string.
UserAgent string
}
Config controls the headless browser behaviour.
type Result ¶
type Result struct {
// HTML is the fully rendered outer HTML of the page after JS execution.
HTML string
// Title is the document title after rendering.
Title string
// FinalURL is the URL after any redirects.
FinalURL string
}
Result holds the rendered page content.
func RenderPage ¶
RenderPage navigates to the given URL in a headless Chrome instance, waits for JavaScript to execute, and returns the rendered HTML.
Click to show internal directories.
Click to hide internal directories.