fetcher

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentFetcher

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

func NewContentFetcher

func NewContentFetcher() *ContentFetcher

func (*ContentFetcher) Fetch

func (cf *ContentFetcher) Fetch(ctx context.Context, url string, opts FetchOptions) (*FetchResult, error)

type FetchMode

type FetchMode string
const (
	FetchModeAuto   FetchMode = "auto"
	FetchModeStatic FetchMode = "static"
	FetchModeJS     FetchMode = "javascript"
)

type FetchOptions

type FetchOptions struct {
	Mode            FetchMode
	Timeout         time.Duration
	UserAgent       string
	BrowserAgent    string
	Cookies         []*http.Cookie
	SkipBanners     bool
	BannerTimeout   time.Duration
	WaitForSelector string
}

type FetchResult

type FetchResult struct {
	HTML     string
	Title    string
	URL      string
	UsedJS   bool
	Metadata map[string]string
}

type SimpleFetcher

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

func NewSimpleFetcher

func NewSimpleFetcher() *SimpleFetcher

func (*SimpleFetcher) FetchStatic

func (sf *SimpleFetcher) FetchStatic(ctx context.Context, url string, opts FetchOptions) (*FetchResult, error)

func (*SimpleFetcher) SetFollowRedirects

func (sf *SimpleFetcher) SetFollowRedirects(follow bool)

SetFollowRedirects configures whether the fetcher follows HTTP redirects

type UserAgentSelector

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

func NewUserAgentSelector

func NewUserAgentSelector() *UserAgentSelector

func (*UserAgentSelector) GetUserAgent

func (uas *UserAgentSelector) GetUserAgent(uaType string) string

GetUserAgent returns a user agent string based on the specified type If uaType is "auto" or empty, it randomly selects from all available user agents If a specific browser type is specified, it randomly selects from that browser's user agents

type UserAgentType

type UserAgentType string
const (
	UserAgentAuto    UserAgentType = "auto"
	UserAgentChrome  UserAgentType = "chrome"
	UserAgentFirefox UserAgentType = "firefox"
	UserAgentSafari  UserAgentType = "safari"
	UserAgentEdge    UserAgentType = "edge"
)

Jump to

Keyboard shortcuts

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