source

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Type      ResultType
	Source    string
	Value     string
	Reference string
	Error     error
}

type ResultType

type ResultType int
const (
	Url ResultType = iota
	Error
)

type Source

type Source interface {
	// Run takes a query as argument and a session object
	// which contains the extractor for url, http client
	// and other stuff.
	Run(context.Context, string, *session.Session) <-chan Result

	// Name returns the name of the source. It is preferred to use lower case names.
	Name() string

	// IsDefault returns true if the current source should be
	// used as part of the default execution.
	IsDefault() bool

	// NeedsKey returns true if the source requires an API key
	NeedsKey() bool

	AddApiKeys([]string)

	// Statistics returns the scrapping statistics for the source
	Statistics() Statistics
}

Source is an interface inherited by each passive source

type Statistics

type Statistics struct {
	TimeTaken time.Duration
	Errors    int
	Results   int
	Skipped   bool
}

Statistics contains statistics about the scraping process

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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