Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultTimeout is the default timeout for Chrome operations. DefaultTimeout time.Duration = 60 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func DefaultFlags ¶
func DefaultFlags() []chromedp.ExecAllocatorOption
DefaultFlags returns the default chromedp flags used for automation. These flags help avoid detection and ensure stable operation.
func RunChrome ¶
RunChrome launches Chrome with the given configuration and executes the extractor function. It handles the Chrome lifecycle (launch, context creation, cleanup) and returns the extracted data.
Parameters:
- config: Chrome configuration (path, timeout, flags)
- extractor: Function that performs the actual extraction using the chromedp context
Returns the extracted data of type T and any error encountered.
Types ¶
type Extractor ¶
Extractor is a function that extracts data from a Chrome context. It receives the chromedp context and should return the extracted data or an error.
type Options ¶
type Options struct {
// Path to the Chrome executable. If empty, chromedp will try to find Chrome automatically.
Path string
// Timeout for the entire Chrome operation. Defaults to 120 seconds if not set.
Timeout time.Duration
// Custom chromedp flags. If empty, DefaultFlags() will be used.
Flags []chromedp.ExecAllocatorOption
}
Options holds configuration for Chrome execution.
Click to show internal directories.
Click to hide internal directories.