schema

package
v0.0.0-...-4fa1762 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDiet

func ParseDiet(s string) recipe.Diet

ParseDiet parses a restricted diet (https://schema.org/RestrictedDiet) string into a Diet type.

func ParseNutritionalInformation

func ParseNutritionalInformation(data map[string]any) recipe.Nutrition

ParseNutritionalInformation parses nutritional information (https://schema.org/NutritionInformation) that's encoded in a map into a Nutrition struct.

Types

type RecipeScraper

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

RecipeScraper is a recipe scraper.

func NewRecipeScraper

func NewRecipeScraper(doc *goquery.Document) (*RecipeScraper, error)

NewRecipeScraper returns a new instance of RecipeScraper. The provided doc is scraped for a recipe and an error is returned if none is found.

func (*RecipeScraper) Author

func (r *RecipeScraper) Author() (string, bool)

Author is the author of the recipe.

func (*RecipeScraper) Categories

func (r *RecipeScraper) Categories() ([]string, bool)

Categories are the categories of the recipe, e.g. appetizer, entrée, etc.

func (*RecipeScraper) CookTime

func (r *RecipeScraper) CookTime() (time.Duration, bool)

CookTime is the time it takes to actually cook the dish.

func (*RecipeScraper) Cuisine

func (r *RecipeScraper) Cuisine() ([]string, bool)

Cuisine is the cuisine of the recipe, e.g. mexican-inspired, french, etc.

func (*RecipeScraper) Description

func (r *RecipeScraper) Description() (string, bool)

Description is the description of the recipe.

func (*RecipeScraper) ImageURL

func (r *RecipeScraper) ImageURL() (string, bool)

ImageURL is a URL to an image of the dish.

func (*RecipeScraper) Ingredients

func (r *RecipeScraper) Ingredients() ([]string, bool)

Ingredients are all the ingredients used in the recipe.

func (*RecipeScraper) Instructions

func (r *RecipeScraper) Instructions() ([]string, bool)

Instructions are all the steps in making the recipe.

func (*RecipeScraper) Language

func (r *RecipeScraper) Language() (string, bool)

Language is the language used in the recipe expressed in IETF BCP 47 standard.

func (*RecipeScraper) Name

func (r *RecipeScraper) Name() (string, bool)

Name is the name of the recipe.

func (*RecipeScraper) Nutrition

func (r *RecipeScraper) Nutrition() (recipe.Nutrition, bool)

Nutrition is nutritional information about the dish.

func (*RecipeScraper) PrepTime

func (r *RecipeScraper) PrepTime() (time.Duration, bool)

PrepTime is the length of time it takes to prepare the items to be used in the instructions.

func (*RecipeScraper) SuitableDiets

func (r *RecipeScraper) SuitableDiets() ([]recipe.Diet, bool)

SuitableDiets indicates dietary restrictions or guidelines for which the recipe is suitable.

func (*RecipeScraper) TotalTime

func (r *RecipeScraper) TotalTime() (time.Duration, bool)

TotalTime is the total time required to perform the instructions (including the prep time).

func (*RecipeScraper) Yields

func (r *RecipeScraper) Yields() (string, bool)

Yields is the quantity that results from the recipe.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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