recipe

package
v0.0.0-...-1b71872 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package recipe extracts recipes from Hello Fresh.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collections

func Collections() ([]string, error)

Collections scrapes a list of recipe collections from the Hello Fresh website.

func IsValidPage

func IsValidPage(page string) (bool, error)

IsValidPage tests whether the provided page is a valid Hello Fresh recipe page.

Types

type Allergen

type Allergen struct {
	ID               string
	Type             string
	Description      string
	TracesOf         bool
	TriggersTracesOf bool
	IconLink         string
	IconPath         string
	Usage            int
	Name             string
	Slug             string
}

type Category

type Category struct {
	ID       string
	Type     string
	Name     string
	Slug     string
	IconLink string
	IconPath string
	Usage    int
}

type Cuisine

type Cuisine struct {
	ID       string
	Type     string
	IconLink string
	IconPath string
	Usage    int
	Name     string
	Slug     string
}

type Ingredient

type Ingredient struct {
	Country           string
	ID                string
	Type              string
	Name              string
	Slug              string
	Description       string
	InternalName      string
	Shipped           bool
	ImageLink         string
	ImagePath         string
	Usage             int
	HasDuplicatedName bool
	Allergens         []string
	Family            IngredientFamily
	UUID              string
}

type IngredientFamily

type IngredientFamily struct {
	ID             string
	Type           string
	Description    string
	Priority       int
	IconLink       string
	IconPath       string
	UsageByCountry map[string]int
	CreatedAt      time.Time
	UpdatedAt      time.Time
	UUID           string
	Name           string
	Slug           string
}

type IngredientYield

type IngredientYield struct {
	ID     string
	Amount float64
	Unit   string
}

type Nutrition

type Nutrition struct {
	Type   string
	Name   string
	Amount float64
	Unit   string
}

type Recipe

type Recipe struct {
	ID                  string
	Country             string
	Name                string
	SeoName             string
	Category            Category
	Slug                string
	Headline            string
	Description         string
	DescriptionHTML     string
	DescriptionMarkdown string
	SeoDescription      string
	Comment             string
	Difficulty          int
	PrepTime            string
	TotalTime           string
	ServingSize         int
	CreatedAt           time.Time
	UpdatedAt           time.Time
	Link                string
	ImageLink           string
	ImagePath           string
	CardLink            string
	VideoLink           string
	Nutrition           []Nutrition
	Ingredients         []Ingredient
	Allergens           []Allergen
	Utensils            []Utensil
	Tags                []Tag
	Cuisines            []Cuisine
	Yields              []Yield
}

type Recipes

type Recipes []Recipe

func ScrapeRecipes

func ScrapeRecipes(page string) (Recipes, error)

ScrapeRecipes scrapes recipes from the JSON payload on the Hello Fresh website.

func (Recipes) YieldIDsToNames

func (rs Recipes) YieldIDsToNames() error

YieldIDsToNames converts recipe IngredientYield IDs to their respective names.

type Tag

type Tag struct {
	ID                       string
	Type                     string
	IconLink                 string
	IconPath                 string
	NumberOfRecipes          int
	NumberOfRecipesByCountry map[string]int
	ColorHandle              string
	Preferences              []string
	Name                     string
	Slug                     string
	DisplayLabel             bool
}

type URL

type URL struct {
	XMLName    xml.Name `xml:"url"`
	LOC        string   `xml:"loc"`
	LastMod    string   `xml:"lastmod"`
	ChangeFreq string   `xml:"changefreq"`
	Priority   float64  `xml:"priority"`
}

type URLSet

type URLSet struct {
	XMLName xml.Name `xml:"urlset"`
	URLs    []URL    `xml:"url"`
}

type Utensil

type Utensil struct {
	ID   string
	Type string
	Name string
}

type Yield

type Yield struct {
	Yields      int
	Ingredients []IngredientYield
}

Jump to

Keyboard shortcuts

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