scraper

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package scraper implements the logic to extract a recipe from a website.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("domain is not implemented")

ErrNotImplemented is the error used when the website is not supported.

Functions

This section is empty.

Types

type HTTPClient added in v1.1.0

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is an interface for making HTTP requests.

type IScraper added in v1.1.0

type IScraper interface {
	Scrape(url string, files services.FilesService) (models.RecipeSchema, error)
}

IScraper is the scraper's interface.

type Scraper added in v1.1.0

type Scraper struct {
	Client HTTPClient
}

Scraper represents the IScraper's implementation.

func NewScraper added in v1.1.0

func NewScraper(client HTTPClient) *Scraper

NewScraper creates a new Scraper.

func (*Scraper) Scrape added in v1.1.0

func (s *Scraper) Scrape(url string, files services.FilesService) (models.RecipeSchema, error)

Scrape extracts the recipe from the given URL. An error will be returned when the URL cannot be parsed.

Source Files

Jump to

Keyboard shortcuts

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