hand 包下
handresult.go
package hand
type IParseProcess interface {
//查询书籍分类
GetClassifs() HandResult
//获取某个分类下面的小说
GetBooks(classifyUrl string,pageIndex int) (HandResult,bool)
//获取某个小说下面的章节
GetChapters(ChapterRequestUrl string) HandResult
//获取某个小说的一章
GetBookContent(BookContentRequestUrl string) HandResult
}
//通过执行方法
func ExcuteProcess(process IParseProcess)IParseProcess {
return process
}
//解析父类
type ParseProcess struct {
//查询书籍请求地址
ClassifRequestUrl string
//查询书籍正则表达式
ClassifRegexpstr string
//获取某个分类下面的小说请求地址
BookRequestUrl string
//获取某个分类下面的小说正则表达式
BookRegexpstr string
//获取某个小说下面的章节请求地址
ChapterRequestUrl string
//获取某个小说下面的章节正则表达式
ChapterRegexpstr string
//获取某个小说的一章请求地址
BookContentRequestUrl string
//获取某个小说的一章正则表达式
BookContentRegexpstr string
}
//开始请求地址
func (pp *ParseProcess) GetContent(url string) []byte {
content, _ := ReptilesDo(url)
return content
}
//处理结果
type HandResult struct {
ResultUrls []string
Items []interface{}
}