spider

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadAll

func ReadAll(r io.Reader, size int) (buff []byte, err error)

func UnZipHttpResp added in v0.7.8

func UnZipHttpResp(response *http.Response, size int) ([]byte, error)

func UnZipRetryResp added in v0.7.8

func UnZipRetryResp(response *resty.Response, size int) ([]byte, error)

Types

type ApiSpider

type ApiSpider struct {
	Jar http.CookieJar
	// contains filtered or unexported fields
}

func NewApiSpider

func NewApiSpider(size int) *ApiSpider

请求数据最大size限制

func NewSingleApiSpider added in v0.6.4

func NewSingleApiSpider(size int, timeout time.Duration, transport *http.Transport) *ApiSpider

func (*ApiSpider) Do

func (a *ApiSpider) Do(request Request) (Response, error)

type Buffer

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

先看一下Buffer的定义,有帮助下面理解

func (*Buffer) Read

func (b *Buffer) Read(p []byte) (n int, err error)

func (*Buffer) ReadFrom

func (b *Buffer) ReadFrom(r io.Reader, size int) (n int64, err error)

func (*Buffer) Reset

func (b *Buffer) Reset()

type CloudflareSpider added in v0.7.0

type CloudflareSpider struct {
	Jar http.CookieJar
	// contains filtered or unexported fields
}

func NewCloudflareSpider added in v0.7.0

func NewCloudflareSpider(size int) *CloudflareSpider

请求数据最大size限制

func (*CloudflareSpider) Do added in v0.7.0

func (f *CloudflareSpider) Do(request Request) (Response, error)

type CookieCallBack added in v0.3.3

type CookieCallBack func() []*http.Cookie

type DhtmlSpider

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

func NewDhtmlSpider

func NewDhtmlSpider() *DhtmlSpider

func (*DhtmlSpider) Do

func (d *DhtmlSpider) Do(request Request) (Response, error)

type FileSpider

type FileSpider struct {
	Jar http.CookieJar
	// contains filtered or unexported fields
}

func NewFileSpider

func NewFileSpider(size int) *FileSpider

请求数据最大size限制

func NewSingleFileSpider added in v0.6.4

func NewSingleFileSpider(size int) *FileSpider

func (*FileSpider) Do

func (f *FileSpider) Do(request Request) (Response, error)

type ProxyCallBack

type ProxyCallBack func() string

type Request

type Request struct {
	Url                 string
	Method              string
	Param               string
	Headers             map[string]string
	Timeout             time.Duration
	Retry               int
	ProxyCallBack       ProxyCallBack
	SocketProxyCallBack SocketProxyCallBack
	CookieCallBack      CookieCallBack
}

type Response

type Response struct {
	RedirectUrl string
	Cookies     []*http.Cookie
	Header      http.Header
	SpiderType  SpiderType
	// contains filtered or unexported fields
}

func (*Response) GetBytes

func (r *Response) GetBytes() []byte

func (*Response) GetCharset

func (r *Response) GetCharset() string

func (*Response) GetContent

func (r *Response) GetContent() string

type ShtmlSpider

type ShtmlSpider struct {
	Jar http.CookieJar
	// contains filtered or unexported fields
}

func NewShtmlSpider

func NewShtmlSpider(size int) *ShtmlSpider

请求数据最大size限制

func NewSingleShtmlSpider added in v0.6.4

func NewSingleShtmlSpider(size int, timeout time.Duration, transport *http.Transport) *ShtmlSpider

func (*ShtmlSpider) Do

func (s *ShtmlSpider) Do(request Request) (Response, error)

type SocketProxyCallBack added in v0.2.4

type SocketProxyCallBack func() (string, string, string)

type Spider

type Spider interface {
	Do(request Request) (Response, error)
}

type SpiderType

type SpiderType int
const (
	Shtml SpiderType = iota + 1
	Dhtml
	File
	Api
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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