Documentation
¶
Index ¶
- Variables
- func Must[T any](v T, err error) T
- type Builder
- func (b *Builder) Attr(name string) (string, error)
- func (b *Builder) CSS(selector string) *Builder
- func (b *Builder) CSSAll(selector string) Nodes
- func (b *Builder) Child(index ...int) *Builder
- func (b *Builder) Children() Nodes
- func (b *Builder) Extract(schema Schema) (Result, error)
- func (b *Builder) HTML() (string, error)
- func (b *Builder) HasClass(name string) (bool, error)
- func (b *Builder) Href() (string, error)
- func (b *Builder) Next() *Builder
- func (b *Builder) NextAll() Nodes
- func (b *Builder) NodeType() (html.NodeType, error)
- func (b *Builder) Parent() *Builder
- func (b *Builder) Parents() Nodes
- func (b *Builder) Prev() *Builder
- func (b *Builder) PrevAll() Nodes
- func (b *Builder) Siblings() Nodes
- func (b *Builder) Src() (string, error)
- func (b *Builder) Tag() (string, error)
- func (b *Builder) Text() (string, error)
- func (b *Builder) XPath(expr string) *Builder
- func (b *Builder) XPathAll(expr string) Nodes
- type ExtractionError
- type Extractor
- type ExtractorBuilder
- func (eb *ExtractorBuilder) Attr(name string) Extractor
- func (eb *ExtractorBuilder) CSS(sel string) *ExtractorBuilder
- func (eb *ExtractorBuilder) Child(index ...int) *ExtractorBuilder
- func (eb *ExtractorBuilder) HTML() Extractor
- func (eb *ExtractorBuilder) Href() Extractor
- func (eb *ExtractorBuilder) Next() *ExtractorBuilder
- func (eb *ExtractorBuilder) Parent() *ExtractorBuilder
- func (eb *ExtractorBuilder) Prev() *ExtractorBuilder
- func (eb *ExtractorBuilder) Src() Extractor
- func (eb *ExtractorBuilder) Text() Extractor
- func (eb *ExtractorBuilder) XPath(expr string) *ExtractorBuilder
- type Nodes
- func (ns Nodes) Any(fn func(*Builder) bool) (bool, error)
- func (ns Nodes) AttrAll(name string) ([]string, error)
- func (ns Nodes) CSS(selector string) Nodes
- func (ns Nodes) Each(fn func(i int, b *Builder))
- func (ns Nodes) Every(fn func(*Builder) bool) (bool, error)
- func (ns Nodes) ExtractAll(schema Schema) ([]Result, error)
- func (ns Nodes) First() *Builder
- func (ns Nodes) Get(index int) *Builder
- func (ns Nodes) Last() *Builder
- func (ns Nodes) Len() (int, error)
- func (ns Nodes) None() (bool, error)
- func (ns Nodes) Some() (bool, error)
- func (ns Nodes) TextAll() ([]string, error)
- func (ns Nodes) XPath(expr string) Nodes
- type Page
- type Result
- type Schema
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder wraps a single node with deferred error propagation.
func (*Builder) Child ¶
Child returns the first element child (no args) or the nth element child (one arg). Skips text and comment nodes.
type ExtractionError ¶
ExtractionError holds per-field errors from Extract or ExtractAll. The partial Result is still returned alongside this error.
func (*ExtractionError) Error ¶
func (e *ExtractionError) Error() string
type Extractor ¶
type Extractor struct {
// contains filtered or unexported fields
}
Extractor is a lazy field definition for use in Schema. Build one with Field(), then chain selectors and call an extractor method.
type ExtractorBuilder ¶
type ExtractorBuilder struct {
// contains filtered or unexported fields
}
ExtractorBuilder accumulates a selector chain before an extractor is chosen.
func Field ¶
func Field() *ExtractorBuilder
Field starts an Extractor chain rooted at the current node (no selector).
func (*ExtractorBuilder) Attr ¶
func (eb *ExtractorBuilder) Attr(name string) Extractor
func (*ExtractorBuilder) CSS ¶
func (eb *ExtractorBuilder) CSS(sel string) *ExtractorBuilder
func (*ExtractorBuilder) Child ¶
func (eb *ExtractorBuilder) Child(index ...int) *ExtractorBuilder
func (*ExtractorBuilder) HTML ¶
func (eb *ExtractorBuilder) HTML() Extractor
func (*ExtractorBuilder) Href ¶
func (eb *ExtractorBuilder) Href() Extractor
func (*ExtractorBuilder) Next ¶
func (eb *ExtractorBuilder) Next() *ExtractorBuilder
func (*ExtractorBuilder) Parent ¶
func (eb *ExtractorBuilder) Parent() *ExtractorBuilder
func (*ExtractorBuilder) Prev ¶
func (eb *ExtractorBuilder) Prev() *ExtractorBuilder
func (*ExtractorBuilder) Src ¶
func (eb *ExtractorBuilder) Src() Extractor
func (*ExtractorBuilder) Text ¶
func (eb *ExtractorBuilder) Text() Extractor
func (*ExtractorBuilder) XPath ¶
func (eb *ExtractorBuilder) XPath(expr string) *ExtractorBuilder
type Nodes ¶
type Nodes struct {
// contains filtered or unexported fields
}
Nodes wraps a collection of nodes with deferred error propagation.
Click to show internal directories.
Click to hide internal directories.