scrapper

package
v0.0.0-...-0fbf873 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCacheNotSet = fmt.Errorf("cache directory is not set")

ErrCacheNotSet is returned when cache directory is not set

Functions

This section is empty.

Types

type Options

type Options struct {
	Logger   *zerolog.Logger
	LogLevel zerolog.Level

	CacheDir string

	UserAgent   string
	MaxBodySize int64
}

Options for scrapper

type Scrapper

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

Scrapper is a scrapper for public hearings

func New

func New(opt *Options) *Scrapper

New scrapper instance

func (Scrapper) ExtractContent

func (s Scrapper) ExtractContent(ctx context.Context, link, selector string, force bool) ([]string, error)

ExtractContent returns content of passed link. Option "force" forces to fetch the page from the network instead of from the cache.

func (s Scrapper) ExtractLinks(ctx context.Context, link, selector string, force bool) ([]string, error)

ExtractLinks return all links from passed selector. Option "force" forces to fetch the page from the network instead of from the cache.

Jump to

Keyboard shortcuts

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