bs4

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.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
}

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

func NewClient

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

NewClient 创建一个文档树

func (*Client) After

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

After 在节点之后添加节点

func (*Client) Append

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

Append 在节点中的末尾添加节点

func (*Client) Attrs

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

Attrs 返回节点的所有属性

func (*Client) Before

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

Before 在节点之前添加节点

func (*Client) Childrens

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

Childrens 寻找所有直接子节点

func (*Client) ChildrensAll

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

ChildrensAll 寻找所有子节点

func (*Client) Clear

func (obj *Client) Clear() *Client

Clear 清空节点内容

func (*Client) Contents

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

Contents 寻找所有内容节点

func (*Client) Copy

func (obj *Client) Copy() *Client

Copy 复制节点

func (*Client) Del

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

Del 删除节点的属性

func (*Client) Find

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

Find 寻找一个节点

func (*Client) Finds

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

Finds 寻找多个节点

func (*Client) Get

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

Get 获取节点的属性

func (*Client) Has

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

Has 判断元素是否包含节点

func (*Client) Html

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

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

func (*Client) Name

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

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

func (*Client) Next

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

Next 寻找下一个节点

func (*Client) Nexts

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

Nexts 寻找之后的所有节点

func (*Client) Parent

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

Parent 返回父节点

func (*Client) Parents

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

Parents 返回所有父节点

func (*Client) Prepend

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

Prepend 在节点中的头部添加节点

func (*Client) Prev

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

Prev 寻找上一个节点

func (*Client) Prevs

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

Prevs 寻找之前的所有节点

func (*Client) Remove

func (obj *Client) Remove() *Client

Remove 删除节点

func (*Client) Replace

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

Replace 替换节点

func (*Client) Set

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

Set 设置节点的属性

func (*Client) Sibs

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

Sibs 寻找所有兄弟节点

func (*Client) Strings

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

Strings 返回所有节点的字符串

func (*Client) Text

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

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

Jump to

Keyboard shortcuts

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