export text and firsttext functions
This commit is contained in:
parent
148b3f261d
commit
bb2d3e26ea
4
html.go
4
html.go
|
@ -79,7 +79,7 @@ func (n *HtmlNode) GetElementsByClass(class string) []*HtmlNode {
|
|||
}
|
||||
}
|
||||
|
||||
func (n *HtmlNode) text() string {
|
||||
func (n *HtmlNode) Text() string {
|
||||
if n == nil {
|
||||
return ""
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ func (n *HtmlNode) text() string {
|
|||
}
|
||||
}
|
||||
|
||||
func (n *HtmlNode) firstText() string {
|
||||
func (n *HtmlNode) FirstText() string {
|
||||
text := n.Find(func(n *HtmlNode) bool { return n.Type == html.TextNode })
|
||||
return strings.TrimSpace(text.Data)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user