CoreHttp2

package
v5.1.34 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MethodGet     = "GET"
	MethodHead    = "HEAD"
	MethodPost    = "POST"
	MethodPut     = "PUT"
	MethodPatch   = "PATCH" // RFC 5789
	MethodDelete  = "DELETE"
	MethodConnect = "CONNECT"
	MethodOptions = "OPTIONS"
	MethodTrace   = "TRACE"
)

Functions

func GetURLEncode

func GetURLEncode(sendURL string) string

GetURLEncode URL编码工具

Types

type Core

type Core struct {
	//请求地址
	Url string
	//请求方法
	Method string
	//参数集合
	Body   []byte
	Params url.Values
	//是否启动混淆头部
	IsRandHeader bool
	//是否启动代理
	IsProxy bool
	ProxyIP string
	//请求总结构体
	Client  *http.Client
	Request *http.Request
	//反馈结构体
	Response *http.Response
	//错误信息
	Err         error
	RequestErr  error
	ResponseErr error
}

Core 构建器 外部所有声明需先构建此构建器,然后根据上下文使用后续

func (*Core) DELETE

func (t *Core) DELETE() *Core

DELETE DELETE方法

func (*Core) DoResp

func (t *Core) DoResp() *Core

DoResp 执行操作

func (*Core) GET

func (t *Core) GET() *Core

GET GET方法

func (*Core) PATCH

func (t *Core) PATCH() *Core

PATCH PATCH方法

func (*Core) POST

func (t *Core) POST() *Core

POST POST方法

func (*Core) PUT

func (t *Core) PUT() *Core

PUT PUT方法

func (*Core) Resp

func (t *Core) Resp() *Core

Resp 获取RESP信息源 注意自行增加关闭机制 param getURL string 获取URL地址 param params url.Values 表单参数,只有post给定,留空则认定为get模式 param proxyIP string 代理IP地址,如果留空跳过 param isSetHeader bool 是否加入头信息加密,建议爬虫使用 return *http.Response,error 数据,错误

func (*Core) ResultBody

func (t *Core) ResultBody() io.ReadCloser

ResultBody 获取原生数据

func (*Core) ResultBytes

func (t *Core) ResultBytes() (result []byte, err error)

ResultBytes 获取byte数据

func (*Core) ResultGoquery

func (t *Core) ResultGoquery() *CoreGoquery

ResultGoquery 通过goquery获取HTML return *goquery.Document , error 文档操作句柄,是否成功

func (*Core) ResultJSON

func (t *Core) ResultJSON(result any) (err error)

ResultJSON 将结果转为json

func (*Core) ResultString

func (t *Core) ResultString() (result string, err error)

ResultString 将结果转为字符串

type CoreGoquery

type CoreGoquery struct {
	//核心
	Core *Core
	//文档集合
	Doc *goquery.Document
	//错误信息
	Err error
}

func (*CoreGoquery) ResultGoqueryFindCount

func (t *CoreGoquery) ResultGoqueryFindCount(findStr string) int

ResultGoqueryFindCount 获取HTML文档字符串长度

Jump to

Keyboard shortcuts

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