Documentation
¶
Overview ¶
Package crawl runs the Douban mirror: it drains the frontier, fetches each URL through the source that serves it, stores the raw bytes and a record, expands the links it discovers, and marks every row's outcome. The engine is resumable (in-flight rows stay pending) and polite (per-host rate limiting), and it never silently caps; it logs what it blocks or skips.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Concurrency int // worker pool size (default 4)
Limit int // max URLs to process this run (0 = drain the frontier)
HTMLDelay time.Duration // per-host spacing for HTML hosts (default 5s)
Types []string // restrict to these entity types (empty = all)
Source string // restrict to this source (empty = all)
Logf func(format string, args ...any)
}
Config tunes a crawl run.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine ties the store and fetchers together.
func New ¶
func New(st *store.Store, html HTMLClient, frodo FrodoClient, cfg Config) *Engine
New builds an Engine. Either fetcher may be nil if a run touches only the other source.
type FrodoClient ¶
type FrodoClient interface {
Get(ctx context.Context, path string, params url.Values) ([]byte, error)
}
FrodoClient fetches a signed API path. *douban.FrodoClient satisfies it.
type HTMLClient ¶
HTMLClient fetches an absolute URL. *douban.Client satisfies it.