Documentation
¶
Overview ¶
Package memory implements the in-memory HTML driver.
Index ¶
- Constants
- Variables
- func EvalCSSX(ctx context.Context, el *HTMLElement, expression runtime.String) (runtime.List, error)
- func EvalXPathTo(doc *goquery.Document, selection *goquery.Selection, expression string) (runtime.Value, error)
- func EvalXPathToElement(doc *goquery.Document, selection *goquery.Selection, expression string) (drivers.HTMLElement, error)
- func EvalXPathToNode(doc *goquery.Document, selection *goquery.Selection, expression string) (drivers.HTMLNode, error)
- func EvalXPathToNodes(doc *goquery.Document, selection *goquery.Selection, expression string) (runtime.List, error)
- func EvalXPathToNodesWith(selection *goquery.Selection, expression string, ...) (runtime.List, error)
- func NewHTMLElement(doc *goquery.Document, node *goquery.Selection) (drivers.HTMLElement, error)
- type Driver
- type HTMLDocument
- func (doc *HTMLDocument) Clone(_ context.Context) (runtime.Cloneable, error)
- func (doc *HTMLDocument) Close() error
- func (doc *HTMLDocument) Compare(other runtime.Value) int
- func (doc *HTMLDocument) Copy() runtime.Value
- func (doc *HTMLDocument) CountBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.Int, error)
- func (doc *HTMLDocument) ExistsBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.Boolean, error)
- func (doc *HTMLDocument) Get(ctx context.Context, key runtime.Value) (runtime.Value, error)
- func (doc *HTMLDocument) GetChildDocuments(ctx context.Context) (runtime.List, error)
- func (doc *HTMLDocument) GetChildNode(ctx context.Context, idx runtime.Int) (runtime.Value, error)
- func (doc *HTMLDocument) GetChildNodes(ctx context.Context) (runtime.List, error)
- func (doc *HTMLDocument) GetElement() drivers.HTMLElement
- func (doc *HTMLDocument) GetName() runtime.String
- func (doc *HTMLDocument) GetNodeName(_ context.Context) (runtime.String, error)
- func (doc *HTMLDocument) GetNodeType(_ context.Context) (runtime.Int, error)
- func (doc *HTMLDocument) GetParentDocument(_ context.Context) (drivers.HTMLDocument, error)
- func (doc *HTMLDocument) GetTitle() runtime.String
- func (doc *HTMLDocument) GetURL() runtime.String
- func (doc *HTMLDocument) Hash() uint64
- func (doc *HTMLDocument) Iterate(_ context.Context) (runtime.Iterator, error)
- func (doc *HTMLDocument) Length(_ context.Context) (runtime.Int, error)
- func (doc *HTMLDocument) MarshalJSON() ([]byte, error)
- func (doc *HTMLDocument) Query(ctx context.Context, q runtime.Query) (runtime.List, error)
- func (doc *HTMLDocument) QuerySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.Value, error)
- func (doc *HTMLDocument) QuerySelectorAll(ctx context.Context, selector drivers.QuerySelector) (runtime.List, error)
- func (doc *HTMLDocument) String() string
- func (doc *HTMLDocument) Type() runtime.Type
- func (doc *HTMLDocument) Unwrap() any
- func (doc *HTMLDocument) XPath(ctx context.Context, expression runtime.String) (runtime.Value, error)
- type HTMLElement
- func (el *HTMLElement) Close() error
- func (el *HTMLElement) Compare(other runtime.Value) int
- func (el *HTMLElement) Copy() runtime.Value
- func (el *HTMLElement) CountBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.Int, error)
- func (el *HTMLElement) ExistsBySelector(_ context.Context, selector drivers.QuerySelector) (runtime.Boolean, error)
- func (el *HTMLElement) Get(ctx context.Context, path runtime.Value) (runtime.Value, error)
- func (el *HTMLElement) GetAttribute(ctx context.Context, name runtime.String) (runtime.Value, error)
- func (el *HTMLElement) GetAttributes(ctx context.Context) (runtime.Map, error)
- func (el *HTMLElement) GetChildNode(ctx context.Context, idx runtime.Int) (runtime.Value, error)
- func (el *HTMLElement) GetChildNodes(_ context.Context) (runtime.List, error)
- func (el *HTMLElement) GetInnerHTML(_ context.Context) (runtime.String, error)
- func (el *HTMLElement) GetInnerHTMLBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.String, error)
- func (el *HTMLElement) GetInnerHTMLBySelectorAll(ctx context.Context, selector drivers.QuerySelector) (runtime.List, error)
- func (el *HTMLElement) GetInnerText(_ context.Context) (runtime.String, error)
- func (el *HTMLElement) GetInnerTextBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.String, error)
- func (el *HTMLElement) GetInnerTextBySelectorAll(ctx context.Context, selector drivers.QuerySelector) (runtime.List, error)
- func (el *HTMLElement) GetNextElementSibling(_ context.Context) (runtime.Value, error)
- func (el *HTMLElement) GetNodeName(_ context.Context) (runtime.String, error)
- func (el *HTMLElement) GetNodeType(_ context.Context) (runtime.Int, error)
- func (el *HTMLElement) GetParentElement(_ context.Context) (runtime.Value, error)
- func (el *HTMLElement) GetPreviousElementSibling(_ context.Context) (runtime.Value, error)
- func (el *HTMLElement) GetStyle(ctx context.Context, name runtime.String) (runtime.Value, error)
- func (el *HTMLElement) GetStyles(ctx context.Context) (runtime.Map, error)
- func (el *HTMLElement) GetValue(_ context.Context) (runtime.Value, error)
- func (el *HTMLElement) Hash() uint64
- func (el *HTMLElement) Iterate(_ context.Context) (runtime.Iterator, error)
- func (el *HTMLElement) Length(ctx context.Context) (runtime.Int, error)
- func (el *HTMLElement) MarshalJSON() ([]byte, error)
- func (el *HTMLElement) Query(ctx context.Context, q runtime.Query) (runtime.List, error)
- func (el *HTMLElement) QuerySelector(_ context.Context, selector drivers.QuerySelector) (runtime.Value, error)
- func (el *HTMLElement) QuerySelectorAll(ctx context.Context, selector drivers.QuerySelector) (runtime.List, error)
- func (el *HTMLElement) RemoveAttribute(ctx context.Context, name ...runtime.String) error
- func (el *HTMLElement) RemoveStyle(ctx context.Context, name ...runtime.String) error
- func (el *HTMLElement) SetAttribute(ctx context.Context, name, value runtime.String) error
- func (el *HTMLElement) SetAttributes(ctx context.Context, attrs runtime.Map) error
- func (el *HTMLElement) SetInnerHTML(_ context.Context, value runtime.String) error
- func (el *HTMLElement) SetInnerHTMLBySelector(ctx context.Context, selector drivers.QuerySelector, innerHTML runtime.String) error
- func (el *HTMLElement) SetInnerText(_ context.Context, innerText runtime.String) error
- func (el *HTMLElement) SetInnerTextBySelector(ctx context.Context, selector drivers.QuerySelector, innerText runtime.String) error
- func (el *HTMLElement) SetStyle(ctx context.Context, name, value runtime.String) error
- func (el *HTMLElement) SetStyles(ctx context.Context, newStyles runtime.Map) error
- func (el *HTMLElement) SetValue(_ context.Context, value runtime.Value) error
- func (el *HTMLElement) String() string
- func (el *HTMLElement) Type() runtime.Type
- func (el *HTMLElement) Unwrap() any
- func (el *HTMLElement) XPath(_ context.Context, expression runtime.String) (runtime.Value, error)
- type HTMLPage
- func (p *HTMLPage) Close() error
- func (p *HTMLPage) Compare(other runtime.Value) int
- func (p *HTMLPage) Copy() runtime.Value
- func (p *HTMLPage) Get(ctx context.Context, key runtime.Value) (runtime.Value, error)
- func (p *HTMLPage) GetCookies(_ context.Context) (*drivers.HTTPCookies, error)
- func (p *HTMLPage) GetFrame(ctx context.Context, idx runtime.Int) (runtime.Value, error)
- func (p *HTMLPage) GetFrames(ctx context.Context) (runtime.List, error)
- func (p *HTMLPage) GetMainFrame() drivers.HTMLDocument
- func (p *HTMLPage) GetResponse(_ context.Context) (drivers.HTTPResponse, error)
- func (p *HTMLPage) GetURL() runtime.String
- func (p *HTMLPage) Hash() uint64
- func (p *HTMLPage) IsClosed() runtime.Boolean
- func (p *HTMLPage) Iterate(ctx context.Context) (runtime.Iterator, error)
- func (p *HTMLPage) Length(ctx context.Context) (runtime.Int, error)
- func (p *HTMLPage) MarshalJSON() ([]byte, error)
- func (p *HTMLPage) Query(ctx context.Context, q runtime.Query) (runtime.List, error)
- func (p *HTMLPage) String() string
- func (p *HTMLPage) Type() runtime.Type
- func (p *HTMLPage) Unwrap() any
- type Option
- func WithAllowedHTTPCode(httpCode int) Option
- func WithAllowedHTTPCodes(httpCodes []int) Option
- func WithConcurrency(value int) Option
- func WithCookie(cookie drivers.HTTPCookie) Option
- func WithCookies(cookies []drivers.HTTPCookie) Option
- func WithCustomName(name string) Option
- func WithCustomTransport(transport *stdhttp.Transport) Option
- func WithDefaultBackoff() Option
- func WithExponentialBackoff() Option
- func WithHeader(name string, value []string) Option
- func WithHeaders(headers *drivers.HTTPHeaders) Option
- func WithLinearBackoff() Option
- func WithMaxRetries(value int) Option
- func WithProxy(address string) Option
- func WithTimeout(duration time.Duration) Option
- func WithUserAgent(value string) Option
- type Options
Constants ¶
View Source
const DriverName = "memory"
Variables ¶
View Source
var ( DefaultConcurrency = 1 DefaultMaxRetries = 5 DefaultTimeout = time.Second * 30 )
Functions ¶
func EvalXPathTo ¶
func EvalXPathToElement ¶
func EvalXPathToNode ¶
func EvalXPathToNodes ¶
func EvalXPathToNodesWith ¶
func NewHTMLElement ¶
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
type HTMLDocument ¶
type HTMLDocument struct {
// contains filtered or unexported fields
}
func NewHTMLDocument ¶
func NewHTMLDocument( node *goquery.Document, url string, parent drivers.HTMLDocument, ) (*HTMLDocument, error)
func NewRootHTMLDocument ¶
func NewRootHTMLDocument( node *goquery.Document, url string, ) (*HTMLDocument, error)
func (*HTMLDocument) Close ¶
func (doc *HTMLDocument) Close() error
func (*HTMLDocument) Copy ¶
func (doc *HTMLDocument) Copy() runtime.Value
func (*HTMLDocument) CountBySelector ¶
func (doc *HTMLDocument) CountBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.Int, error)
func (*HTMLDocument) ExistsBySelector ¶
func (doc *HTMLDocument) ExistsBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.Boolean, error)
func (*HTMLDocument) GetChildDocuments ¶
func (*HTMLDocument) GetChildNode ¶
func (*HTMLDocument) GetChildNodes ¶
func (*HTMLDocument) GetElement ¶
func (doc *HTMLDocument) GetElement() drivers.HTMLElement
func (*HTMLDocument) GetName ¶
func (doc *HTMLDocument) GetName() runtime.String
func (*HTMLDocument) GetNodeName ¶
func (*HTMLDocument) GetNodeType ¶
func (*HTMLDocument) GetParentDocument ¶
func (doc *HTMLDocument) GetParentDocument(_ context.Context) (drivers.HTMLDocument, error)
func (*HTMLDocument) GetTitle ¶
func (doc *HTMLDocument) GetTitle() runtime.String
func (*HTMLDocument) GetURL ¶
func (doc *HTMLDocument) GetURL() runtime.String
func (*HTMLDocument) Hash ¶
func (doc *HTMLDocument) Hash() uint64
func (*HTMLDocument) MarshalJSON ¶
func (doc *HTMLDocument) MarshalJSON() ([]byte, error)
func (*HTMLDocument) QuerySelector ¶
func (doc *HTMLDocument) QuerySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.Value, error)
func (*HTMLDocument) QuerySelectorAll ¶
func (doc *HTMLDocument) QuerySelectorAll(ctx context.Context, selector drivers.QuerySelector) (runtime.List, error)
func (*HTMLDocument) String ¶
func (doc *HTMLDocument) String() string
func (*HTMLDocument) Type ¶
func (doc *HTMLDocument) Type() runtime.Type
func (*HTMLDocument) Unwrap ¶
func (doc *HTMLDocument) Unwrap() any
type HTMLElement ¶
type HTMLElement struct {
// contains filtered or unexported fields
}
func (*HTMLElement) Close ¶
func (el *HTMLElement) Close() error
func (*HTMLElement) Copy ¶
func (el *HTMLElement) Copy() runtime.Value
func (*HTMLElement) CountBySelector ¶
func (el *HTMLElement) CountBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.Int, error)
func (*HTMLElement) ExistsBySelector ¶
func (el *HTMLElement) ExistsBySelector(_ context.Context, selector drivers.QuerySelector) (runtime.Boolean, error)
func (*HTMLElement) GetAttribute ¶
func (*HTMLElement) GetAttributes ¶
func (*HTMLElement) GetChildNode ¶
func (*HTMLElement) GetChildNodes ¶
func (*HTMLElement) GetInnerHTML ¶
func (*HTMLElement) GetInnerHTMLBySelector ¶
func (el *HTMLElement) GetInnerHTMLBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.String, error)
func (*HTMLElement) GetInnerHTMLBySelectorAll ¶
func (el *HTMLElement) GetInnerHTMLBySelectorAll(ctx context.Context, selector drivers.QuerySelector) (runtime.List, error)
func (*HTMLElement) GetInnerText ¶
func (*HTMLElement) GetInnerTextBySelector ¶
func (el *HTMLElement) GetInnerTextBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.String, error)
func (*HTMLElement) GetInnerTextBySelectorAll ¶
func (el *HTMLElement) GetInnerTextBySelectorAll(ctx context.Context, selector drivers.QuerySelector) (runtime.List, error)
func (*HTMLElement) GetNextElementSibling ¶
func (*HTMLElement) GetNodeName ¶
func (*HTMLElement) GetNodeType ¶
func (*HTMLElement) GetParentElement ¶
func (*HTMLElement) GetPreviousElementSibling ¶
func (*HTMLElement) Hash ¶
func (el *HTMLElement) Hash() uint64
func (*HTMLElement) MarshalJSON ¶
func (el *HTMLElement) MarshalJSON() ([]byte, error)
func (*HTMLElement) QuerySelector ¶
func (el *HTMLElement) QuerySelector(_ context.Context, selector drivers.QuerySelector) (runtime.Value, error)
func (*HTMLElement) QuerySelectorAll ¶
func (el *HTMLElement) QuerySelectorAll(ctx context.Context, selector drivers.QuerySelector) (runtime.List, error)
func (*HTMLElement) RemoveAttribute ¶
func (*HTMLElement) RemoveStyle ¶
func (*HTMLElement) SetAttribute ¶
func (*HTMLElement) SetAttributes ¶
func (*HTMLElement) SetInnerHTML ¶
func (*HTMLElement) SetInnerHTMLBySelector ¶
func (el *HTMLElement) SetInnerHTMLBySelector(ctx context.Context, selector drivers.QuerySelector, innerHTML runtime.String) error
func (*HTMLElement) SetInnerText ¶
func (*HTMLElement) SetInnerTextBySelector ¶
func (el *HTMLElement) SetInnerTextBySelector(ctx context.Context, selector drivers.QuerySelector, innerText runtime.String) error
func (*HTMLElement) String ¶
func (el *HTMLElement) String() string
func (*HTMLElement) Type ¶
func (el *HTMLElement) Type() runtime.Type
func (*HTMLElement) Unwrap ¶
func (el *HTMLElement) Unwrap() any
type HTMLPage ¶
type HTMLPage struct {
// contains filtered or unexported fields
}
func NewHTMLPage ¶
func NewHTMLPage( qdoc *goquery.Document, url string, response drivers.HTTPResponse, cookies *drivers.HTTPCookies, ) (*HTMLPage, error)
func (*HTMLPage) GetCookies ¶
func (*HTMLPage) GetMainFrame ¶
func (p *HTMLPage) GetMainFrame() drivers.HTMLDocument
func (*HTMLPage) GetResponse ¶
func (*HTMLPage) MarshalJSON ¶
type Option ¶
type Option func(opts *Options)
func WithAllowedHTTPCode ¶
func WithAllowedHTTPCodes ¶
func WithConcurrency ¶
func WithCookie ¶
func WithCookie(cookie drivers.HTTPCookie) Option
func WithCookies ¶
func WithCookies(cookies []drivers.HTTPCookie) Option
func WithCustomName ¶
func WithCustomTransport ¶
func WithDefaultBackoff ¶
func WithDefaultBackoff() Option
func WithExponentialBackoff ¶
func WithExponentialBackoff() Option
func WithHeader ¶
func WithHeaders ¶
func WithHeaders(headers *drivers.HTTPHeaders) Option
func WithLinearBackoff ¶
func WithLinearBackoff() Option
func WithMaxRetries ¶
func WithTimeout ¶
func WithUserAgent ¶
Click to show internal directories.
Click to hide internal directories.