Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateRating ¶
type AggregateRating struct { ReviewCount int `json:"reviewCount,omitempty"` RatingCount int `json:"ratingCount,omitempty"` RatingValue float64 `json:"ratingValue,omitempty"` BestRating int `json:"bestRating,omitempty"` WorstRating int `json:"worstRating,omitempty"` }
AggregateRating represents the average rating based on multiple ratings or reviews https://schema.org/AggregateRating
type DataInput ¶
type DataInput struct { Url string Text string RootNode *html.Node `json:"-"` Document *goquery.Document `json:"-"` Schemas *microdata.Microdata `json:"-"` }
DataInput represents the input data for the scraper
type HowToSection ¶
type HowToSection struct { HowToStep // because it's optional to have a group, we have to embed `HowToStep` here Steps []*HowToStep `json:"itemListElement,omitempty"` }
HowToSection a group of steps in the instructions https://schema.org/HowToSection
type HowToStep ¶
type HowToStep struct { Name string `json:"name,omitempty"` Text string `json:"text,omitempty"` Url string `json:"url,omitempty"` Image string `json:"image,omitempty"` Video string `json:"video,omitempty"` }
HowToStep a step in the instructions https://schema.org/HowToStep
type ImageObject ¶
type ImageObject struct { Url string `json:"url,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` Caption string `json:"caption,omitempty"` }
ImageObject represents an image object https://schema.org/ImageObject
type InputOptions ¶
InputOptions options for pre-processing input
type NutritionInformation ¶
type NutritionInformation struct { Calories string `json:"calories,omitempty"` // The number of calories. ServingSize string `json:"servingSize,omitempty"` // The serving size, in terms of the number of volume or mass. CarbohydrateContent string `json:"carbohydrateContent,omitempty"` // The number of grams of carbohydrates. CholesterolContent string `json:"cholesterolContent,omitempty"` // The number of milligrams of cholesterol. FatContent string `json:"fatContent,omitempty"` // The number of grams of fat. FiberContent string `json:"fiberContent,omitempty"` // The number of grams of fiber. ProteinContent string `json:"proteinContent,omitempty"` // The number of grams of protein. SaturatedFatContent string `json:"saturatedFatContent,omitempty"` // The number of grams of saturated fat. SodiumContent string `json:"sodiumContent,omitempty"` // The number of milligrams of sodium. SugarContent string `json:"sugarContent,omitempty"` // The number of grams of sugar. TransFatContent string `json:"transFatContent,omitempty"` // The number of grams of trans fat. UnsaturatedFatContent string `json:"unsaturatedFatContent,omitempty"` // The number of grams of unsaturated fat. }
NutritionInformation according to https://schema.org/NutritionInformation
type Organization ¶
type Organization struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Url string `json:"url,omitempty"` Logo string `json:"logo,omitempty"` }
Organization according to https://schema.org/Organization
type Person ¶
type Person struct { Name string `json:"name,omitempty"` KnowsAbout string `json:"knowsAbout,omitempty"` JobTitle string `json:"jobTitle,omitempty"` Description string `json:"description,omitempty"` Url string `json:"url,omitempty"` Image string `json:"image,omitempty"` }
Person according to https://schema.org/Person
type Recipe ¶
type Recipe struct { Url string `json:"url,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Language string `json:"inLanguage,omitempty"` ThumbnailUrl string `json:"thumbnailUrl,omitempty"` Images []*ImageObject `json:"image,omitempty"` Author *Person `json:"author,omitempty"` Publisher *Organization `json:"publisher,omitempty"` Text string `json:"text,omitempty"` PrepTime float64 `json:"prepTime,omitempty"` CookTime float64 `json:"cookTime,omitempty"` TotalTime float64 `json:"totalTime,omitempty"` Difficulty string `json:"difficulty,omitempty"` // FIXME: `difficulty` is not a part of Recipe schema, it can be `educationalLevel`, but I don't like it https://github.com/schemaorg/schemaorg/issues/3130 CookingMethod string `json:"cookingMethod,omitempty"` Diets []string `json:"suitableForDiet,omitempty"` Categories []string `json:"recipeCategory,omitempty"` Cuisines []string `json:"recipeCuisine,omitempty"` Keywords []string `json:"keywords,omitempty"` Yield int `json:"recipeYield,omitempty"` // alias `yield` Ingredients []string `json:"recipeIngredient,omitempty"` // alias `supply` Equipment []string `json:"tool,omitempty"` // FIXME: `recipeEquipment` is not a part of Recipe schema https://github.com/schemaorg/schemaorg/issues/3132 Instructions []*HowToSection `json:"recipeInstructions,omitempty"` // alias `step` Notes []string `json:"correction,omitempty"` // some notes or advices for the recipe Nutrition *NutritionInformation `json:"nutrition,omitempty"` Rating *AggregateRating `json:"aggregateRating,omitempty"` CommentCount int `json:"commentCount,omitempty"` Video *VideoObject `json:"video,omitempty"` Links []string `json:"citation,omitempty"` // maybe not the cleanest name, but we can store additional links here DateModified *time.Time `json:"dateModified,omitempty"` DatePublished *time.Time `json:"datePublished,omitempty"` }
Recipe is the basic struct for the recipe https://schema.org/Recipe Perhaps, I would rename recipeYield, recipeIngredient, recipeInstructions to their aliases, but many websites expect only these names (like Google Search https://developers.google.com/search/docs/appearance/structured-data/recipe)
func (*Recipe) AddImage ¶
func (r *Recipe) AddImage(image *ImageObject)
type VideoObject ¶
type VideoObject struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Duration string `json:"duration,omitempty"` EmbedUrl string `json:"embedUrl,omitempty"` ContentUrl string `json:"contentUrl,omitempty"` ThumbnailUrl string `json:"thumbnailUrl,omitempty"` UploadDate *time.Time `json:"uploadDate,omitempty"` }
VideoObject represents a video object https://schema.org/VideoObject