Documentation
¶
Index ¶
- Variables
- func EncodeHttpRequest(req *HttpRequest) ([]byte, error)
- func EncodeShortStream(s Stream) []byte
- type CallbackFunc
- type HttpRequest
- func BodyRequest(self Stream, method string, url string, body io.Reader, callback CallbackFunc) (*HttpRequest, error)
- func DecodeHttpRequest(b []byte) (*HttpRequest, error)
- func FormRequest(self Stream, url string, fromData map[string][]string, callback CallbackFunc) (*HttpRequest, error)
- func JsonRequest(self Stream, url string, jsonData map[string]interface{}, ...) (*HttpRequest, error)
- func Request(self Stream, url string, callback CallbackFunc) (*HttpRequest, error)
- type HttpResponse
- type Item
- type Stream
- func DecodeShortStream(buf []byte) (Stream, error)
- func StreamListRangeFloat(self Stream, only func(value float64) (Stream, error), f []float64) (Stream, error)
- func StreamListRangeInt(self Stream, only func(i int) (Stream, error), start, end int) (Stream, error)
- func StreamListRangeString(self Stream, only func(value string) (Stream, error), s []string) (Stream, error)
- func StreamLists(self Stream, streams ...Stream) Stream
- type StreamList
Constants ¶
This section is empty.
Variables ¶
View Source
var (
EncodeHttpRequestIsNilErr = errors.New("you cannot encode http request an nil type")
)
http
View Source
var (
InvalidEncodingErr = errors.New("decode invalid content, please check your content")
)
shortStream
Functions ¶
func EncodeHttpRequest ¶
func EncodeHttpRequest(req *HttpRequest) ([]byte, error)
Types ¶
type CallbackFunc ¶
type CallbackFunc func(response *HttpResponse) (Stream, error)
type HttpRequest ¶
type HttpRequest struct {
*http.Request
// 爬虫回调函数
Callback CallbackFunc
// 跳过过滤器
SkipFilter bool
// 带上请求的一些参数
Meta map[string]interface{}
// 下载失败重新尝试次数
Retry int
// contains filtered or unexported fields
}
func BodyRequest ¶
func BodyRequest( self Stream, method string, url string, body io.Reader, callback CallbackFunc, ) (*HttpRequest, error)
func DecodeHttpRequest ¶
func DecodeHttpRequest(b []byte) (*HttpRequest, error)
func FormRequest ¶
func FormRequest( self Stream, url string, fromData map[string][]string, callback CallbackFunc, ) (*HttpRequest, error)
func JsonRequest ¶
func JsonRequest( self Stream, url string, jsonData map[string]interface{}, callback CallbackFunc, ) (*HttpRequest, error)
func Request ¶
func Request(self Stream, url string, callback CallbackFunc) (*HttpRequest, error)
几种 http new func
func (*HttpRequest) FQDN ¶
func (h *HttpRequest) FQDN() string
func (*HttpRequest) UId ¶
func (h *HttpRequest) UId() string
type HttpResponse ¶
type HttpResponse struct {
*http.Response
// 带上请求的一些参数
Meta map[string]interface{}
Stream
// 解析函数
Callback CallbackFunc
// contains filtered or unexported fields
}
func (*HttpResponse) Bytes ¶
func (h *HttpResponse) Bytes() []byte
func (*HttpResponse) ParseName ¶
func (h *HttpResponse) ParseName() string
func (*HttpResponse) Text ¶
func (h *HttpResponse) Text() string
func (*HttpResponse) WithHttpAndRequestStream ¶
func (h *HttpResponse) WithHttpAndRequestStream(sReq *HttpRequest, req *http.Response)
func (*HttpResponse) Xpath ¶
func (h *HttpResponse) Xpath(expr string) []*xpath
type Item ¶
func BasicItemBandName ¶
type Stream ¶
控制流
func DecodeShortStream ¶
func StreamListRangeFloat ¶
func StreamListRangeInt ¶
func StreamListRangeString ¶
func StreamLists ¶
type StreamList ¶
type StreamList struct {
Stream
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.