spider

package
v1.1.18 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomUA

func RandomUA() string

RandomUA 生成随机 UA 字符串

Types

type DoFunc

type DoFunc func(req *http.Request) (*http.Response, error)

type HttpSpider

type HttpSpider struct {
	CookieMap map[string]string
	Headers   map[string]string
	HttpDo    DoFunc
}

func NewHttpSpider

func NewHttpSpider(do DoFunc) *HttpSpider

NewHttpSpider 创建一个 http 爬虫,do 为 nil 时默认使用 http.DefaultClient.Do

func (*HttpSpider) Do

func (b *HttpSpider) Do(req *http.Request) (*http.Response, error)

func (*HttpSpider) Get

func (b *HttpSpider) Get(url string) (*http.Response, error)

func (*HttpSpider) ReadBody

func (b *HttpSpider) ReadBody(resp *http.Response) ([]byte, error)

Jump to

Keyboard shortcuts

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