crawler

package
v0.0.0-...-98360cb Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crawler

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

func New

func New(filter FilterFunc, yieldTitle YieldTitleFunc, yieldURL YieldURLFunc, yieldError YieldErrorFunc, ops Options) *Crawler

func (*Crawler) Feed

func (cr *Crawler) Feed(ctx context.Context, depth int, links ...string)

type FilterFunc

type FilterFunc func(ctx context.Context, r io.Reader, yieldTitle func(pos int, title string) error, yieldLink func(pos int, link string) error) error

type Options

type Options struct {
	Client *http.Client

	UserAgent string

	// Zero for unlimited depth
	Depth int

	// Zero for no limit
	ParallelRequestsPerHost int
}

type YieldErrorFunc

type YieldErrorFunc func(origin, link string, pos int, err error)

type YieldTitleFunc

type YieldTitleFunc func(depth, pos int, origin string, title string)

type YieldURLFunc

type YieldURLFunc func(depth, pos int, origin string, originalLink string, link *url.URL, external bool) bool

Jump to

Keyboard shortcuts

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