Documentation ¶
Index ¶
- func ParseDiet(s string) recipe.Diet
- func ParseNutritionalInformation(data map[string]any) recipe.Nutrition
- type RecipeScraper
- func (r *RecipeScraper) Author() (string, bool)
- func (r *RecipeScraper) Categories() ([]string, bool)
- func (r *RecipeScraper) CookTime() (time.Duration, bool)
- func (r *RecipeScraper) Cuisine() ([]string, bool)
- func (r *RecipeScraper) Description() (string, bool)
- func (r *RecipeScraper) ImageURL() (string, bool)
- func (r *RecipeScraper) Ingredients() ([]string, bool)
- func (r *RecipeScraper) Instructions() ([]string, bool)
- func (r *RecipeScraper) Language() (string, bool)
- func (r *RecipeScraper) Name() (string, bool)
- func (r *RecipeScraper) Nutrition() (recipe.Nutrition, bool)
- func (r *RecipeScraper) PrepTime() (time.Duration, bool)
- func (r *RecipeScraper) SuitableDiets() ([]recipe.Diet, bool)
- func (r *RecipeScraper) TotalTime() (time.Duration, bool)
- func (r *RecipeScraper) Yields() (string, bool)
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 ¶
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.