scrape

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("scrape",
	fx.Provide(
		FxNewScraper,
	),
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Targets    []Target
	UserAgents []string
}

type FxNewScraperParams

type FxNewScraperParams struct {
	fx.In
	Log       *zap.Logger
	Config    Config
	Extractor extractors.Extractor
	CurlHTTP  *curlhttp.CurlHttp
}

type NewScraperParams

type NewScraperParams struct {
	Log        *zap.Logger
	Config     Config
	Extractors extractors.Extractor
	CurlHTTP   *curlhttp.CurlHttp
}

type ScrapeResult

type ScrapeResult struct {
	Name   string
	Labels map[string]string
	Price  float64
}

type Scraper

type Scraper struct {
	Log        *zap.Logger
	Config     Config
	Extractors extractors.Extractor
	CurlHTTP   *curlhttp.CurlHttp
}

func FxNewScraper

func FxNewScraper(p FxNewScraperParams) *Scraper

func NewScraper

func NewScraper(p NewScraperParams) *Scraper

func (*Scraper) Scrape

func (s *Scraper) Scrape(ch chan *ScrapeResult)

type Target

type Target struct {
	Cookies     map[string]string
	Headers     map[string][]string
	Page        string
	HTTPVersion string `mapstructure: "httpversion"`
	Compression bool

	Script string
	Labels map[string]string
	Name   string
}

Jump to

Keyboard shortcuts

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