Documentation
¶
Index ¶
- func CommonFetchMultiTorrents(ctx context.Context, c *colly.Collector, conf *SiteMapConfig, urls []string) ([]*models.PHPTorrentInfo, error)
- func CommonFetchTorrentInfo(ctx context.Context, c *colly.Collector, conf *SiteMapConfig, url string) (*models.PHPTorrentInfo, error)
- func GetSeedCache(ctx context.Context) *bigcache.BigCache
- func NewCollectorWithTransport() *colly.Collector
- type CMCTParser
- func (p *CMCTParser) ParseDiscount(e *colly.HTMLElement, info *models.PHPTorrentInfo)
- func (p *CMCTParser) ParseHR(e *colly.HTMLElement, info *models.PHPTorrentInfo)
- func (p *CMCTParser) ParseTitleAndID(e *colly.HTMLElement, info *models.PHPTorrentInfo)
- func (p *CMCTParser) ParseTorrentSizeMB(e *colly.HTMLElement, info *models.PHPTorrentInfo)
- type DefaultReferer
- type HDSkyParser
- func (p *HDSkyParser) ParseDiscount(e *colly.HTMLElement, info *models.PHPTorrentInfo)
- func (p *HDSkyParser) ParseHR(e *colly.HTMLElement, info *models.PHPTorrentInfo)
- func (p *HDSkyParser) ParseTitleAndID(e *colly.HTMLElement, info *models.PHPTorrentInfo)
- func (p *HDSkyParser) ParseTorrentSizeMB(e *colly.HTMLElement, info *models.PHPTorrentInfo)
- type ParserConfig
- type ParserOption
- type RefererProvider
- type SharedSiteConfig
- type SiteConfig
- type SiteMapConfig
- type SiteParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommonFetchMultiTorrents ¶
func CommonFetchMultiTorrents(ctx context.Context, c *colly.Collector, conf *SiteMapConfig, urls []string) ([]*models.PHPTorrentInfo, error)
CommonFetchMultiTorrents 并发抓取多个种子信息 CommonFetchMultiTorrents 并发抓取多个种子信息,并返回结果和单一错误
func CommonFetchTorrentInfo ¶
func CommonFetchTorrentInfo(ctx context.Context, c *colly.Collector, conf *SiteMapConfig, url string) (*models.PHPTorrentInfo, error)
CommonFetchTorrentInfo 获取种子信息
Types ¶
type CMCTParser ¶ added in v0.0.3
type CMCTParser struct {
Config ParserConfig
}
CMCTParser 实现了 SiteParser 接口
func NewCMCTParser ¶ added in v0.0.3
func NewCMCTParser(options ...ParserOption) *CMCTParser
func (*CMCTParser) ParseDiscount ¶ added in v0.0.3
func (p *CMCTParser) ParseDiscount(e *colly.HTMLElement, info *models.PHPTorrentInfo)
ParseDiscount 解析优惠类型和结束时间
func (*CMCTParser) ParseHR ¶ added in v0.0.3
func (p *CMCTParser) ParseHR(e *colly.HTMLElement, info *models.PHPTorrentInfo)
ParseHR 解析 HR 状态
func (*CMCTParser) ParseTitleAndID ¶ added in v0.0.3
func (p *CMCTParser) ParseTitleAndID(e *colly.HTMLElement, info *models.PHPTorrentInfo)
ParseTitleAndID 解析标题和种子 ID
func (*CMCTParser) ParseTorrentSizeMB ¶ added in v0.0.3
func (p *CMCTParser) ParseTorrentSizeMB(e *colly.HTMLElement, info *models.PHPTorrentInfo)
type DefaultReferer ¶
type DefaultReferer struct {
// contains filtered or unexported fields
}
func NewDefaultReferer ¶
func NewDefaultReferer(siteName models.SiteGroup) *DefaultReferer
NewDefaultReferer 构造函数,用于初始化 refererMap
func (*DefaultReferer) GetReferer ¶
func (d *DefaultReferer) GetReferer() string
GetReferer 实现 RefererProvider 接口
type HDSkyParser ¶
type HDSkyParser struct {
Config ParserConfig
}
HDSkyParser 实现了 SiteParser 接口
func NewHDSkyParser ¶
func NewHDSkyParser(options ...ParserOption) *HDSkyParser
func (*HDSkyParser) ParseDiscount ¶
func (p *HDSkyParser) ParseDiscount(e *colly.HTMLElement, info *models.PHPTorrentInfo)
ParseDiscount 解析优惠类型和结束时间
func (*HDSkyParser) ParseHR ¶
func (p *HDSkyParser) ParseHR(e *colly.HTMLElement, info *models.PHPTorrentInfo)
ParseHR 解析 HR 状态
func (*HDSkyParser) ParseTitleAndID ¶
func (p *HDSkyParser) ParseTitleAndID(e *colly.HTMLElement, info *models.PHPTorrentInfo)
ParseTitleAndID 解析标题和种子 ID
func (*HDSkyParser) ParseTorrentSizeMB ¶
func (p *HDSkyParser) ParseTorrentSizeMB(e *colly.HTMLElement, info *models.PHPTorrentInfo)
type ParserOption ¶
type ParserOption func(*ParserConfig)
func WithTimeLayout ¶
func WithTimeLayout(layout string) ParserOption
type RefererProvider ¶
type RefererProvider interface {
GetReferer() string
}
type SharedSiteConfig ¶
type SharedSiteConfig struct {
}
type SiteConfig ¶
type SiteConfig struct {
RefererConf RefererProvider
}
type SiteMapConfig ¶
type SiteMapConfig struct {
Name string // 站点名称
Config models.SiteConfig
Parser SiteParser // 站点特定解析器
CustomHeaders map[string]string // 特定站点覆盖的请求头
}
func NewSiteMapConfig ¶
func NewSiteMapConfig(name models.SiteGroup, cookie string, conf models.SiteConfig, parser SiteParser) *SiteMapConfig
单个 URL 创建单个 SiteMapConfig
type SiteParser ¶
type SiteParser interface {
ParseTitleAndID(e *colly.HTMLElement, info *models.PHPTorrentInfo)
ParseDiscount(e *colly.HTMLElement, info *models.PHPTorrentInfo)
ParseHR(e *colly.HTMLElement, info *models.PHPTorrentInfo)
ParseTorrentSizeMB(e *colly.HTMLElement, info *models.PHPTorrentInfo)
}
Click to show internal directories.
Click to hide internal directories.