Documentation ¶
Index ¶
- func ParseHTML(body []byte) (*goquery.Document, error)
- type HTMLElement
- func (he HTMLElement) Attr(key string) string
- func (he HTMLElement) Child(selector string, num int) *HTMLElement
- func (he HTMLElement) ChildAttr(selector, attrName string) string
- func (he HTMLElement) ChildText(selector string) string
- func (he HTMLElement) ChildrenAttr(selector, attrName string) []string
- func (he HTMLElement) ChildrenText(selector string) []string
- func (he HTMLElement) Each(selector string, callback func(int, *HTMLElement))
- func (he HTMLElement) FirstChild(selector string) *HTMLElement
- func (he HTMLElement) InnerHTML() (string, error)
- func (he HTMLElement) LastChild(selector string) *HTMLElement
- func (he HTMLElement) OuterHTML() (string, error)
- func (he HTMLElement) Text() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HTMLElement ¶
func NewHTMLElementFromSelectionNode ¶
NewHTMLElementFromSelectionNode 创建一个元素
func (HTMLElement) Child ¶
func (he HTMLElement) Child(selector string, num int) *HTMLElement
Child 返回第 num 个匹配选择器的子元素,num 不是索引,而是从 1 开始的顺序号
func (HTMLElement) ChildAttr ¶
func (he HTMLElement) ChildAttr(selector, attrName string) string
ChildAttr 在当前元素内部根据选择器查找元素,并返回第一个匹配的目标元素的属性值
func (HTMLElement) ChildText ¶
func (he HTMLElement) ChildText(selector string) string
ChildText 在当前元素内部根据选择器查找元素,并返回第一个匹配的目标元素的文本内容
func (HTMLElement) ChildrenAttr ¶
func (he HTMLElement) ChildrenAttr(selector, attrName string) []string
ChildrenAttr 在当前元素内部根据选择器查找元素,并返回全部匹配的目标元素的属性值切片
func (HTMLElement) ChildrenText ¶
func (he HTMLElement) ChildrenText(selector string) []string
ChildrenText 在当前元素内部根据选择器查找元素,并返回全部匹配的目标元素的文本切片
func (HTMLElement) Each ¶
func (he HTMLElement) Each(selector string, callback func(int, *HTMLElement))
Each 处理每一个与选择器匹配的元素
func (HTMLElement) FirstChild ¶
func (he HTMLElement) FirstChild(selector string) *HTMLElement
FirstChild 返回第一个匹配选择器的子元素
func (HTMLElement) InnerHTML ¶
func (he HTMLElement) InnerHTML() (string, error)
InnerHTML 当前元素的内部 HTML 代码
func (HTMLElement) LastChild ¶
func (he HTMLElement) LastChild(selector string) *HTMLElement
LastChild 返回最后一个匹配选择器的子元素
func (HTMLElement) OuterHTML ¶
func (he HTMLElement) OuterHTML() (string, error)
OuterHTML 当前元素的整体 HTML 代码
Click to show internal directories.
Click to hide internal directories.