snatchs

package
v0.0.0-...-b58bbae Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// 默认分类
	DEF_CATE_ID = 13

	// 请求失败重试次数
	RETRY = 5
)

Variables

View Source
var (
	ErrNotProvider  = errors.New("没有获取到采集点")
	ErrNotResp      = errors.New("没有返回")
	ErrNotRule      = errors.New("没有采集规则")
	ErrNotNov       = errors.New("获取小说失败")
	ErrNotURL       = errors.New("没有传入URL地址")
	ErrNotNovName   = errors.New("获取小说书名失败")
	ErrNotNovURL    = errors.New("获取小说URL失败")
	ErrNotNovAuthor = errors.New("获取小说作者失败")
	ErrNotChapTitle = errors.New("获取小说章节标题失败")
	ErrNotFindURL   = errors.New("没有配置搜索页URL地址")
	ErrInvalidURL   = errors.New("无效的URL地址")
)

Functions

This section is empty.

Types

type Snatch

type Snatch struct {
	// contains filtered or unexported fields
}

func NewSnatch

func NewSnatch(proxyFunc func() string) *Snatch

func (*Snatch) Filter

func (this *Snatch) Filter(filter, kw string) string

采集内容过滤

func (*Snatch) FindNovel

func (this *Snatch) FindNovel(provider *models.SnatchRule, kw string) (*SnatchInfo, error)

查找小说

func (*Snatch) GetChapter

func (this *Snatch) GetChapter(provider *models.SnatchRule, rawurl string) (*SnatchInfo, error)

获取小说章节内容

func (*Snatch) GetChapters

func (this *Snatch) GetChapters(provider *models.SnatchRule, rawurl string) ([]*SnatchInfo, error)

获取小说章节列表

func (*Snatch) GetNovel

func (this *Snatch) GetNovel(provider *models.SnatchRule, rawurl string) (*SnatchInfo, error)

获取一本小说

func (*Snatch) IsBookURL

func (this *Snatch) IsBookURL(provider *models.SnatchRule, rawurl string) bool

是否小说简介页面

func (*Snatch) IsCrawlerURL

func (this *Snatch) IsCrawlerURL(provider *models.SnatchRule, rawurl string) bool

是否小说是否爬虫页面

func (*Snatch) Proxy

func (this *Snatch) Proxy(proxyFunc func() string)

代理设置

type SnatchInfo

type SnatchInfo struct {
	UseTime    time.Duration
	Title      string
	Nov        *models.Novel
	Chap       *models.Chapter
	Url        string
	Source     string
	ChapterUrl string
	NextUrl    string
	PreUrl     string
}

采集内容信息

Jump to

Keyboard shortcuts

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