gopkg/crawler/i_handler.go
2021-12-20 19:03:04 +08:00

31 lines
776 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package crawler ...
//
// Description : crawler ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2021-12-20 4:50 PM
package crawler
import (
"github.com/gocolly/colly"
)
// IRequestHandler 请求结果的处理
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 4:50 PM 2021/12/20
type IRequestHandler interface {
// OnRequest 在发起请求前被调用
OnRequest() colly.RequestCallback
// OnError 请求过程中如果发生错误被调用
OnError() colly.ErrorCallback
// OnResponse 收到回复后被调用
OnResponse() colly.ResponseCallback
// OnHTML 在OnResponse之后被调用如果收到的内容是HTML
OnHTML() (string, colly.HTMLCallback)
// OnScraped 在OnHTML之后被调用
OnScraped() colly.ScrapedCallback
}