bs4

package
v0.0.0-...-b1b21d8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2023 License: LGPL-3.0 Imports: 6 Imported by: 0

README

功能概述

  • 基于goquery 二次封装,简化了调用逻辑
  • 支持对文档树增删改查
  • 调用逻辑与python中的bs4库大部分相同

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

文档树操作========================================================================= start

func NewClient

func NewClient(txt string, baseUrl ...string) *Client

创建一个文档树

func (*Client) After

func (obj *Client) After(str string) *Client

在节点之后添加节点

func (*Client) Append

func (obj *Client) Append(str string) *Client

在节点中的末尾添加节点

func (*Client) Attrs

func (obj *Client) Attrs() map[string]string

返回节点的所有属性

func (*Client) Before

func (obj *Client) Before(str string) *Client

在节点之前添加节点

func (*Client) Childrens

func (obj *Client) Childrens(elections ...string) []*Client

寻找所有直接子节点

func (*Client) ChildrensAll

func (obj *Client) ChildrensAll(election ...string) []*Client

寻找所有子节点

func (*Client) Clear

func (obj *Client) Clear() *Client

清空节点内容

func (*Client) Contents

func (obj *Client) Contents(elections ...string) []*Client

寻找所有内容节点

func (*Client) Copy

func (obj *Client) Copy() *Client

复制节点

func (*Client) Del

func (obj *Client) Del(key string) *Client

删除节点的属性

func (*Client) Find

func (obj *Client) Find(election string) *Client

寻找一个节点

func (*Client) Finds

func (obj *Client) Finds(election string) []*Client

寻找多个节点

func (*Client) Get

func (obj *Client) Get(key string, defaultValue ...string) string

获取节点的属性

func (*Client) Has

func (obj *Client) Has(obj2 *Client) bool

判断元素是否包含节点

func (*Client) Html

func (obj *Client) Html(content ...string) string

返回节点的dom 字符串或设置节点的dom

func (*Client) Name

func (obj *Client) Name(str ...string) string

返回节点名称或设置节点名称

func (*Client) Next

func (obj *Client) Next(elections ...string) *Client

寻找下一个节点

func (*Client) Nexts

func (obj *Client) Nexts(elections ...string) []*Client

寻找之后的所有节点

func (*Client) Parent

func (obj *Client) Parent(elections ...string) *Client

返回父节点

func (*Client) Parents

func (obj *Client) Parents(elections ...string) []*Client

返回所有父节点

func (*Client) Prepend

func (obj *Client) Prepend(str string) *Client

在节点中的头部添加节点

func (*Client) Prev

func (obj *Client) Prev(elections ...string) *Client

寻找上一个节点

func (*Client) Prevs

func (obj *Client) Prevs(elections ...string) []*Client

寻找之前的所有节点

func (*Client) Remove

func (obj *Client) Remove() *Client

删除节点

func (*Client) Replace

func (obj *Client) Replace(str string) *Client

替换节点

func (*Client) Set

func (obj *Client) Set(key string, val string) *Client

设置节点的属性

func (*Client) Sibs

func (obj *Client) Sibs(elections ...string) []*Client

寻找所有兄弟节点

func (*Client) Strings

func (obj *Client) Strings() []string

返回所有节点的字符串

func (*Client) Text

func (obj *Client) Text(str ...string) string

返回节点内容或设置节点内容

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL