controller

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoQuery

func GoQuery(doc *html.Node, selector string) (string, error)

func HTMLQuery

func HTMLQuery(doc *html.Node, selector string) (string, error)

Types

type Analyzer

type Analyzer func(*html.Node, string) (string, error)

func AnalyzerBySelector

func AnalyzerBySelector(selector string) Analyzer

type C

type C interface {
	Scrape(ctx context.Context, cfg ScrapeConfig) (ScrapeResults, error)
	AvailableMethods() []fetcher.FetchMethod
}

type Controller

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

func New

func (*Controller) AvailableMethods

func (c *Controller) AvailableMethods() []fetcher.FetchMethod

func (*Controller) Scrape

func (c *Controller) Scrape(ctx context.Context, cfg ScrapeConfig) (ScrapeResults, error)

type ScrapeConfig

type ScrapeConfig struct {
	Method             string
	URL                string
	DataSelectors      map[string]string
	Multiple           bool
	ItemParentSelector string

	NextPageSelector string
	Limit            int

	VisitItemDetailPage bool
	ItemLinkSelector    string
}

type ScrapeResults

type ScrapeResults struct {
	Num    int
	Data   []map[string]string
	Errors []error
}

Jump to

Keyboard shortcuts

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