extractors

package
v0.0.0-...-94edfc7 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("extractors", fx.Provide(FxNewTengoExtractor))

Functions

func TengoAttributeExtractor

func TengoAttributeExtractor(selector string, attribute string, log *zap.Logger) *tengo.UserFunction

func TengoInnerTextExtractor

func TengoInnerTextExtractor(selector string, log *zap.Logger) *tengo.UserFunction

Types

type Config

type Config struct {
	Attribute map[string]struct {
		Selector  string
		Attribute string
	} `mapstructure:"attribute"`
	InnerText map[string]struct {
		Selector string
	} `mapstructure:"innerText"`
}

type Extractor

type Extractor interface {
	Get(page io.Reader, script string) (float64, error)
}

Extractor receives a response body in it's entirety and extracts the price from it.

func FxNewTengoExtractor

func FxNewTengoExtractor(p FxNewTengoExtractorParams) Extractor

type FxNewTengoExtractorParams

type FxNewTengoExtractorParams struct {
	fx.In

	Config Config
	Log    *zap.Logger
}

type NewTengoExtractorParams

type NewTengoExtractorParams struct {
	Config Config
	Log    *zap.Logger
}

type TengoExtractor

type TengoExtractor struct {
	Log *zap.Logger
	// contains filtered or unexported fields
}

func NewTengoExtractors

func NewTengoExtractors(p NewTengoExtractorParams) *TengoExtractor

func (*TengoExtractor) AsObject

func (t *TengoExtractor) AsObject() tengo.Object

func (*TengoExtractor) Get

func (t *TengoExtractor) Get(page io.Reader, script string) (float64, error)

Jump to

Keyboard shortcuts

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