Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultBrowsers = []string{"chrome", "firefox", "curl"}
DefaultBrowsers defines the priority order for browsers
Functions ¶
func CleanHTML ¶
func CleanHTML(content []byte, opts *CleaningOptions) []byte
CleanHTML removes unwanted elements from HTML content based on options
func StripJavaScript ¶
StripJavaScript removes JavaScript code from HTML content
Types ¶
type Browser ¶
type Browser interface { // Name returns the name of the browser Name() string // Fetch retrieves content from a URL Fetch(url string) ([]byte, error) // SetCleaningOptions sets the HTML cleaning options SetCleaningOptions(*CleaningOptions) }
Browser represents a web browser interface for fetching content
func GetDefaultBrowser ¶
GetDefaultBrowser tries browsers in order of preference and returns the first available one
func NewBrowser ¶
NewBrowser creates a new browser instance based on the browser name
type Chrome ¶
type Chrome struct {
// contains filtered or unexported fields
}
func (*Chrome) SetCleaningOptions ¶
func (c *Chrome) SetCleaningOptions(opts *CleaningOptions)
type CleaningOptions ¶
type CleaningOptions struct { KeepHeader bool // Keep header elements if true KeepStyles bool // Keep inline and internal styles if true KeepComments bool // Keep HTML comments if true }
CleaningOptions configures what elements to remove from HTML
func DefaultCleaningOptions ¶
func DefaultCleaningOptions() *CleaningOptions
DefaultCleaningOptions returns the default cleaning configuration
type Curl ¶
type Curl struct {
// contains filtered or unexported fields
}
func (*Curl) SetCleaningOptions ¶
func (c *Curl) SetCleaningOptions(opts *CleaningOptions)
type DefaultExecutableFinder ¶
type DefaultExecutableFinder struct {
// contains filtered or unexported fields
}
DefaultExecutableFinder implements ExecutableFinder
func (*DefaultExecutableFinder) Find ¶
func (f *DefaultExecutableFinder) Find() (string, error)
type ExecutableFinder ¶
ExecutableFinder is an interface for finding browser executables
type Firefox ¶
type Firefox struct {
// contains filtered or unexported fields
}
func NewFirefox ¶
func (*Firefox) SetCleaningOptions ¶
func (f *Firefox) SetCleaningOptions(opts *CleaningOptions)
type Links ¶
type Links struct {
// contains filtered or unexported fields
}
Links browser implementation