Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
Action TypedAction
}
Action is used for JSON marshaling/unmarshaling of polymorphic actions
func NewPDFAction ¶
func NewPDFAction(options PDFActionOptions) Action
NewPDFAction creates a new PDF action
func NewScreenshotAction ¶
func NewScreenshotAction(options ScreenshotActionOptions) Action
NewScreenshotAction creates a new screenshot action
func NewWaitAction ¶
func NewWaitAction(options WaitActionOptions) Action
NewWaitAction creates a new wait action
func (*Action) MarshalJSON ¶
MarshalJSON implements custom marshaling for polymorphic actions
func (*Action) UnmarshalJSON ¶
UnmarshalJSON implements custom unmarshaling for polymorphic actions
type BaseAction ¶
type BaseAction struct {
Type string `json:"type"`
}
BaseAction contains common fields for all actions
func (BaseAction) GetType ¶
func (a BaseAction) GetType() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client defines a client for fetching pages via a remote proxy.
func NewClient ¶
func NewClient(options ClientOptions) *Client
NewClient creates a new client with the given options.
type ClientOptions ¶
type ClientOptions struct {
BaseURL string // Optional proxy base URL
AuthToken string // Optional authorization token
Timeout time.Duration // Optional HTTP timeout
}
ClientOptions defines the options for the client.
type Meta ¶
type Meta struct {
Tag string `json:"tag"`
Name string `json:"name,omitempty"`
Content string `json:"content,omitempty"`
Charset string `json:"charset,omitempty"`
Property string `json:"property,omitempty"`
}
Meta represents a meta tag on a page.
type Metadata ¶
type Metadata struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Language string `json:"language,omitempty"`
Keywords string `json:"keywords,omitempty"`
Author string `json:"author,omitempty"`
Canonical string `json:"canonical,omitempty"`
Heading string `json:"heading,omitempty"`
Robots string `json:"robots,omitempty"`
Image string `json:"image,omitempty"`
Icon string `json:"icon,omitempty"`
PublishedTime string `json:"published_time,omitempty"`
Tags []Meta `json:"tags,omitempty"`
}
Metadata conveys high level information about a page.
type PDFAction ¶
type PDFAction struct {
BaseAction
Format string `json:"format,omitempty"` // A4, Letter, Legal, etc.
}
PDFAction generates a PDF of the page
type PDFActionOptions ¶
type PDFActionOptions struct {
Format string `json:"format,omitempty"` // A4, Letter, Legal, etc.
}
PDFActionOptions represents the options for a PDF action
type Request ¶
type Request struct {
URL string `json:"url"`
OnlyMainContent bool `json:"only_main_content,omitempty"`
IncludeTags []string `json:"include_tags,omitempty"`
ExcludeTags []string `json:"exclude_tags,omitempty"`
MaxAge int `json:"max_age,omitempty"` // milliseconds
Timeout int `json:"timeout,omitempty"` // milliseconds
WaitFor int `json:"wait_for,omitempty"` // milliseconds
Fetcher string `json:"fetcher,omitempty"`
Mobile bool `json:"mobile,omitempty"`
Prettify bool `json:"prettify,omitempty"`
Formats []string `json:"formats,omitempty"`
Actions []Action `json:"actions,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
Request defines the JSON payload for fetch requests.
type Response ¶
type Response struct {
URL string `json:"url"`
StatusCode int `json:"status_code"`
Headers map[string]string `json:"headers"`
HTML string `json:"html,omitempty"`
Markdown string `json:"markdown,omitempty"`
Screenshot string `json:"screenshot,omitempty"`
PDF string `json:"pdf,omitempty"`
Error string `json:"error,omitempty"`
Metadata Metadata `json:"metadata,omitempty"`
Links []Link `json:"links,omitempty"`
}
Response defines the JSON payload for fetch responses.
type ScreenshotAction ¶
type ScreenshotAction struct {
BaseAction
FullPage bool `json:"full_page,omitempty"`
}
ScreenshotAction triggers a screenshot of the page
type ScreenshotActionOptions ¶
type ScreenshotActionOptions struct {
FullPage bool `json:"full_page,omitempty"`
}
ScreenshotActionOptions represents the options for a screenshot action
type TypedAction ¶
type TypedAction interface {
GetType() string
}
TypedAction represents an action to be taken on a page
type WaitAction ¶
type WaitAction struct {
BaseAction
Selector string `json:"selector,omitempty"` // Wait for element to appear
Duration int `json:"duration,omitempty"` // Wait for specific duration in milliseconds
}
WaitAction waits for a condition or time
type WaitActionOptions ¶
type WaitActionOptions struct {
Selector string `json:"selector,omitempty"` // Wait for element to appear
Duration int `json:"duration,omitempty"` // Wait for specific duration in milliseconds
}
WaitActionOptions represents the options for a wait action