Documentation
¶
Index ¶
- Constants
- Variables
- type NodeEnum
- type NodeSet
- func BytesSource(text []byte) (ret NodeSet)
- func FileSource(htmlFile string) (ret NodeSet)
- func HTTPSource(url string) (ret NodeSet)
- func Nodes(nodes ...*html.Node) (ret NodeSet)
- func Source(r io.Reader) (ret NodeSet)
- func StringSource(text string) (ret NodeSet)
- func URISource(uri string) (ret NodeSet)
- func (p NodeSet) A() (ret NodeSet)
- func (p NodeSet) Any() (ret NodeSet)
- func (p NodeSet) AttrVal(k string, exactlyOne ...bool) (text string, err error)
- func (p NodeSet) Attr__0(k string, exactlyOne ...bool) (text string, err error)
- func (p NodeSet) Attr__1(k, v string) (ret NodeSet)
- func (p NodeSet) Attribute(k, v string) (ret NodeSet)
- func (p NodeSet) Cache() NodeSet
- func (p NodeSet) CachedLen() int
- func (p NodeSet) Child() (ret NodeSet)
- func (p NodeSet) ChildEqualText(text string) (ret NodeSet)
- func (p NodeSet) ChildN(level int) (ret NodeSet)
- func (p NodeSet) ChildrenAsText(doReplace bool) (ret NodeSet)
- func (p NodeSet) Class(v string) (ret NodeSet)
- func (p NodeSet) Collect() (items []*html.Node, err error)
- func (p NodeSet) CollectOne(exactly ...bool) (item *html.Node, err error)
- func (p NodeSet) ContainsClass(v string) (ret NodeSet)
- func (p NodeSet) ContainsText(text string) (ret NodeSet)
- func (p NodeSet) Div() (ret NodeSet)
- func (p NodeSet) Dump() NodeSet
- func (p NodeSet) Element(v interface{}) (ret NodeSet)
- func (p NodeSet) EqualText(text string) (ret NodeSet)
- func (p NodeSet) ExactText(exactlyOne ...bool) (text string, err error)
- func (p NodeSet) FirstChild(nodeType html.NodeType) (ret NodeSet)
- func (p NodeSet) FirstElementChild() (ret NodeSet)
- func (p NodeSet) FirstTextChild() (ret NodeSet)
- func (p NodeSet) ForEach(filter func(node NodeSet))
- func (p NodeSet) H1() (ret NodeSet)
- func (p NodeSet) H2() (ret NodeSet)
- func (p NodeSet) H3() (ret NodeSet)
- func (p NodeSet) H4() (ret NodeSet)
- func (p NodeSet) Href(v string) (ret NodeSet)
- func (p NodeSet) HrefVal(exactlyOne ...bool) (text string, err error)
- func (p NodeSet) ID(v string) (ret NodeSet)
- func (p NodeSet) Img() (ret NodeSet)
- func (p NodeSet) Int(exactlyOne ...bool) (v int, err error)
- func (p NodeSet) LastChild(nodeType html.NodeType) (ret NodeSet)
- func (p NodeSet) LastElementChild() (ret NodeSet)
- func (p NodeSet) LastTextChild() (ret NodeSet)
- func (p NodeSet) Li() (ret NodeSet)
- func (p NodeSet) Match(filter func(node *html.Node) bool) (ret NodeSet)
- func (p NodeSet) Nav() (ret NodeSet)
- func (p NodeSet) NextSibling(delta int) (ret NodeSet)
- func (p NodeSet) NextSiblings() (ret NodeSet)
- func (p NodeSet) Ok() bool
- func (p NodeSet) Ol() (ret NodeSet)
- func (p NodeSet) One() (ret NodeSet)
- func (p NodeSet) Parent() (ret NodeSet)
- func (p NodeSet) ParentN(level int) (ret NodeSet)
- func (p NodeSet) PrevSibling(delta int) (ret NodeSet)
- func (p NodeSet) PrevSiblings() (ret NodeSet)
- func (p NodeSet) Printf(w io.Writer, format string, params ...interface{}) NodeSet
- func (p NodeSet) ScanInt(format string, exactlyOne ...bool) (v int, err error)
- func (p NodeSet) Span() (ret NodeSet)
- func (p NodeSet) Td() (ret NodeSet)
- func (p NodeSet) Text(exactlyOne ...bool) (text string, err error)
- func (p NodeSet) Ul() (ret NodeSet)
- func (p NodeSet) UnitedFloat(exactlyOne ...bool) (v float64, err error)
Constants ¶
const (
GopPackage = true // to indicate this is a Go+ package
)
Variables ¶
var ( ErrNotFound = syscall.ENOENT ErrBreak = syscall.ELOOP ErrTooManyNodes = errors.New("too many nodes") ErrInvalidNode = errors.New("invalid node") // ErrEmptyText represents an `empty text` error. ErrEmptyText = errors.New("empty text") // ErrInvalidScanFormat represents an `invalid fmt.Scan format` error. ErrInvalidScanFormat = errors.New("invalid fmt.Scan format") )
var ( // DefaultUserAgent is the default UserAgent and is used by HTTPSource. DefaultUserAgent string ReqHeaderProc func(req *http.Request) )
Functions ¶
This section is empty.
Types ¶
type NodeSet ¶
func BytesSource ¶
BytesSource returns a NodeSet from a text.
func FileSource ¶
FileSource returns a NodeSet of a htmlFile.
func StringSource ¶
StringSource returns a NodeSet from a text.
func (NodeSet) AttrVal ¶
AttrVal returns attribute value of NodeSet. exactlyOne=false: if NodeSet is more than one, returns first node's attribute value.
func (NodeSet) ChildEqualText ¶
ChildEqualText returns NodeSet which child node text equals `text`.
func (NodeSet) ChildrenAsText ¶
func (NodeSet) CollectOne ¶
func (NodeSet) ContainsClass ¶
ContainsClass returns NodeSet which class contains `v`.
func (NodeSet) ContainsText ¶
ContainsText returns NodeSet which node type is TextNode and it's text contains `text`.
func (NodeSet) Div ¶
Div returns NodeSet which node type is ElementNode and it's element type is `div`.
func (NodeSet) Element ¶
Element returns NodeSet which node type is ElementNode and it's element type is `v`.
func (NodeSet) EqualText ¶
EqualText returns NodeSet which node type is TextNode and it's text equals `text`.
func (NodeSet) ExactText ¶
ExactText returns text of NodeSet. exactlyOne=false: if NodeSet is more than one, returns first node's text (if node type is not TextNode, return error).
func (NodeSet) FirstElementChild ¶
func (NodeSet) FirstTextChild ¶
func (NodeSet) H1 ¶
H1 returns NodeSet which node type is ElementNode and it's element type is `h1`.
func (NodeSet) H2 ¶
H2 returns NodeSet which node type is ElementNode and it's element type is `h2`.
func (NodeSet) H3 ¶
H3 returns NodeSet which node type is ElementNode and it's element type is `h3`.
func (NodeSet) H4 ¶
H4 returns NodeSet which node type is ElementNode and it's element type is `h4`.
func (NodeSet) HrefVal ¶
HrefVal returns href attribute's value of NodeSet. exactlyOne=false: if NodeSet is more than one, returns first node's attribute value.
func (NodeSet) Img ¶
Img returns NodeSet which node type is ElementNode and it's element type is `img`.
func (NodeSet) Int ¶
Int returns int value of p.Text(). exactlyOne=false: if NodeSet is more than one, returns first node's value.
func (NodeSet) LastElementChild ¶
func (NodeSet) LastTextChild ¶
func (NodeSet) Li ¶
Li returns NodeSet which node type is ElementNode and it's element type is `li`.
func (NodeSet) Nav ¶
Nav returns NodeSet which node type is ElementNode and it's element type is `nav`.
func (NodeSet) NextSibling ¶
func (NodeSet) NextSiblings ¶
func (NodeSet) Ol ¶
Ol returns NodeSet which node type is ElementNode and it's element type is `ol`.
func (NodeSet) PrevSibling ¶
func (NodeSet) PrevSiblings ¶
func (NodeSet) ScanInt ¶
ScanInt returns int value of p.Text(). exactlyOne=false: if NodeSet is more than one, returns first node's value.
func (NodeSet) Span ¶
Span returns NodeSet which node type is ElementNode and it's element type is `span`.
func (NodeSet) Td ¶
Td returns NodeSet which node type is ElementNode and it's element type is `td`.
func (NodeSet) Text ¶
Text returns text of NodeSet. exactlyOne=false: if NodeSet is more than one, returns first node's text.