scraper

package
v0.0.0-...-da5f288 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigRoot = "./scraper/configs/"

ConfigRoot is the folder where scraper configs are stored

View Source
const InStockHTTP = "http://schema.org/InStock"

InStockHTTP is the standard in stock enum in HTTP

View Source
const InStockHTTPS = "https://schema.org/InStock"

InStockHTTPS is the standard in stock enum in HTTPS

Variables

This section is empty.

Functions

func GetDocument

func GetDocument(sanitized *url.URL) (doc *goquery.Document, err error)

GetDocument returns the goquery document from an URL

func Instance

func Instance() *scraper

Instance gets the static singleton reference using double check synchronization. It returns the reference to the scraper instance.

Types

type LazadaScraper

type LazadaScraper struct{}

LazadaScraper is an empty struct to hold methods that implements Scraper

func (LazadaScraper) GetHost

func (s LazadaScraper) GetHost() (host string)

GetHost returns the host name for the scraper

func (LazadaScraper) ScrapeInfo

func (s LazadaScraper) ScrapeInfo(path *url.URL) (item models.Item, err error)

ScrapeInfo extracts the required information out of a page from the scraper config

func (LazadaScraper) ScrapePrice

func (s LazadaScraper) ScrapePrice(item models.Item) (itemPrice models.ItemPrice, err error)

ScrapePrice returns the current price for an item

type Scraper

type Scraper interface {
	ScrapeInfo(path *url.URL) (item models.Item, err error)
	ScrapePrice(item models.Item) (itemPrice models.ItemPrice, err error)
	GetHost() (host string)
}

Scraper is an interface implemented by all Scrapers

type TikiScraper

type TikiScraper struct{}

TikiScraper is an empty struct to hold methods that implements Scraper

func (TikiScraper) GetHost

func (s TikiScraper) GetHost() (host string)

GetHost returns the host name for the scraper

func (TikiScraper) ScrapeInfo

func (s TikiScraper) ScrapeInfo(path *url.URL) (item models.Item, err error)

ScrapeInfo extracts the required information out of a page from the scraper config

func (TikiScraper) ScrapePrice

func (s TikiScraper) ScrapePrice(item models.Item) (itemPrice models.ItemPrice, err error)

ScrapePrice returns the current price for an item

Jump to

Keyboard shortcuts

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