Documentation ¶
Index ¶
- func CopyMap(m1 map[string]string) map[string]string
- func Map2Reader(m map[string]string) io.Reader
- type Client
- type Collector
- type Constructor
- type ConstructorFunc
- type Context
- type Crawler
- type Error
- type ErrorHandler
- type ErrorHandlerFunc
- type Errors
- type HttpMethod
- type HttpStatus
- type Logger
- type MultiRequest
- type Option
- func DebuggerOption(d debug.Debugger) Option
- func DefaultDebuggerOption(l *zap.Logger) Option
- func ErrorHandlerOption(handler ErrorHandler) Option
- func LimitOption(parallelism int, delay, randomDelay time.Duration) Option
- func RequestHandlerOption(handler RequestHandler) Option
- func ResponseHandlerOption(handler ResponseHandler) Option
- func ResponseHeadersHandlerOption(handler ResponseHeadersHandler) Option
- func ScrapedHandlerOption(handler ScrapedHandler) Option
- func SetInvokerOption(i interface{}) Option
- func WithLoggerOption(l *zap.Logger) Option
- type Request
- type RequestHandler
- type RequestHandlerFunc
- type Response
- type ResponseHandler
- type ResponseHandlerFunc
- type ResponseHeadersHandler
- type ResponseHeadersHandlerFunc
- type ScrapedHandler
- type ScrapedHandlerFunc
- type TypeAssertionError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Constructor ¶
func RecoveryConstructor ¶
func RecoveryConstructor() Constructor
func ReplaceConstructor ¶
func ReplaceConstructor(newConstructor Constructor) (oldConstructor Constructor)
type ConstructorFunc ¶
func (ConstructorFunc) Construct ¶
func (f ConstructorFunc) Construct(options ...Option) Crawler
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext() *Context
type Crawler ¶
type Crawler interface {
Crawl(out interface{}, ins ...interface{}) error
}
func NewSimpleCrawler ¶
type Error ¶
type Error struct { errors.LocatorError // contains filtered or unexported fields }
type ErrorHandler ¶
type ErrorHandlerFunc ¶
func (ErrorHandlerFunc) HandleError ¶
func (f ErrorHandlerFunc) HandleError(response Response, err error) error
type HttpMethod ¶
type HttpMethod string
const ( HttpMethodGet HttpMethod = http.MethodGet HttpMethodPost HttpMethod = http.MethodPost )
type HttpStatus ¶
type HttpStatus int
type MultiRequest ¶
type MultiRequest struct {
// contains filtered or unexported fields
}
func NewMultiRequest ¶
func NewMultiRequest() MultiRequest
func (*MultiRequest) Append ¶
func (m *MultiRequest) Append(method HttpMethod, url string, requestData io.Reader, header http.Header)
type Option ¶
type Option interface { //Apply 不应该在构造方法外调用 Apply(c Crawler) }
func DebuggerOption ¶
func DefaultDebuggerOption ¶
func ErrorHandlerOption ¶
func ErrorHandlerOption(handler ErrorHandler) Option
func RequestHandlerOption ¶
func RequestHandlerOption(handler RequestHandler) Option
func ResponseHandlerOption ¶
func ResponseHandlerOption(handler ResponseHandler) Option
func ResponseHeadersHandlerOption ¶
func ResponseHeadersHandlerOption(handler ResponseHeadersHandler) Option
func ScrapedHandlerOption ¶
func ScrapedHandlerOption(handler ScrapedHandler) Option
func SetInvokerOption ¶
func SetInvokerOption(i interface{}) Option
func WithLoggerOption ¶
type RequestHandler ¶
type RequestHandlerFunc ¶
func (RequestHandlerFunc) HandleRequest ¶
func (f RequestHandlerFunc) HandleRequest(request Request) error
type ResponseHandler ¶
type ResponseHandlerFunc ¶
func (ResponseHandlerFunc) HandleResponse ¶
func (f ResponseHandlerFunc) HandleResponse(response Response) error
type ResponseHeadersHandler ¶
type ResponseHeadersHandlerFunc ¶
func (ResponseHeadersHandlerFunc) HandleResponseHeaders ¶
func (f ResponseHeadersHandlerFunc) HandleResponseHeaders(response Response) error
type ScrapedHandler ¶
type ScrapedHandlerFunc ¶
func (ScrapedHandlerFunc) HandleScraped ¶
func (f ScrapedHandlerFunc) HandleScraped(response Response) error
type TypeAssertionError ¶
type TypeAssertionError struct {
errors.LocatorError
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.