Documentation
¶
Overview ¶
Package selector provides CSS and XPath selector engines for HTML documents. It supports standard CSS selectors via cascadia, XPath via antchfx/htmlquery, and custom pseudo-elements (::text, ::attr()) matching Scrapy/Parsel syntax.
Index ¶
- func CSS(root *parser.Adaptable, sel string) ([]*parser.Adaptable, error)
- func CSSAttr(root *parser.Adaptable, sel, attr string) ([]string, error)
- func CSSFirst(root *parser.Adaptable, sel string) (*parser.Adaptable, error)
- func CSSText(root *parser.Adaptable, sel string) ([]string, error)
- func XPath(root *parser.Adaptable, expr string) ([]*parser.Adaptable, error)
- func XPathFirst(root *parser.Adaptable, expr string) (*parser.Adaptable, error)
- type PseudoResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CSSAttr ¶
CSSAttr extracts attribute values from elements matching a CSS selector with ::attr(name) pseudo-element.
func CSSText ¶
CSSText extracts text from elements matching a CSS selector with ::text pseudo-element.
Types ¶
type PseudoResult ¶
type PseudoResult struct {
Nodes []*parser.Adaptable
Texts []string // populated for ::text or ::attr()
}
PseudoResult holds the result of a pseudo-element extraction.
Click to show internal directories.
Click to hide internal directories.