scrapers

package
v0.0.0-...-fdc35f2 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoResultFound    = errors.New("no result found")
	ErrIsinMismatch     = errors.New("isin mismatch")
	ErrEmptyInfoURL     = errors.New("parse search returned an empty info URL")
	ErrInfoRequestIsNil = errors.New("info request is nil")
	ErrPriceNotFound    = errors.New("price not found")
	ErrDateNotFound     = errors.New("date not found")
)

Errors

Functions

func NewQuoteGetter

func NewQuoteGetter(scr Scraper) quotegetter.QuoteGetter

NewQuoteGetter is ..

func SplitPriceCurrency

func SplitPriceCurrency(txt string, priceFirst bool) (priceStr string, currencyStr string, err error)

SplitPriceCurrency is ...

Types

type Error

type Error struct {
	*ParseInfoResult
	// contains filtered or unexported fields
}

Error is

func (*Error) Error

func (e *Error) Error() string

Error return the string representation of the error

func (*Error) Isin

func (e *Error) Isin() string

Isin returns the Isin of the error

func (*Error) Source

func (e *Error) Source() string

Source returns the Source of the error

func (*Error) URL

func (e *Error) URL() string

URL returns the URL of the error

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the inner error

type ErrorType

type ErrorType int

ErrorType is ...

const (
	Success ErrorType = iota
	NoResultFoundError
	IsinMismatchError
	GetSearchError
	ParseSearchError
	GetInfoError
	ParseInfoError
	PriceNotFoundError
	InvalidPriceError
	DateNotFoundError
	InvalidDateError
	IsinNotFoundError
)

ErrorType enum

func (ErrorType) String

func (i ErrorType) String() string

type ParseInfoResult

type ParseInfoResult struct {
	IsinStr     string
	PriceStr    string
	CurrencyStr string
	DateStr     string
	DateLayout  string
}

ParseInfoResult is ...

type Scraper

type Scraper interface {
	Source() string
	Client() *http.Client
	GetSearch(ctx context.Context, isin string) (*http.Request, error)
	ParseSearch(doc *goquery.Document, isin string) (string, error)
	GetInfo(ctx context.Context, isin, url string) (*http.Request, error)
	ParseInfo(doc *goquery.Document, isin string) (*ParseInfoResult, error)
}

Scraper interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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