Skip to content

Commit

Permalink
Ingredient grouping support for tasty (hhursev#1325)
Browse files Browse the repository at this point in the history
  • Loading branch information
jknndy authored Oct 25, 2024
1 parent c4441fc commit 0c1b257
Show file tree
Hide file tree
Showing 5 changed files with 317 additions and 0 deletions.
6 changes: 6 additions & 0 deletions recipe_scrapers/tasty.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
from ._abstract import AbstractScraper
from ._grouping_utils import group_ingredients


class Tasty(AbstractScraper):
@classmethod
def host(cls):
return "tasty.co"

def ingredient_groups(self):
return group_ingredients(
self.ingredients(), self.soup, ".ingredient-section-name", ".ingredient"
)
File renamed without changes.
File renamed without changes.
112 changes: 112 additions & 0 deletions tests/test_data/tasty.co/tasty_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"author": "Scott Loitsch",
"canonical_url": "https://tasty.co/recipe/homemade-cinnamon-rolls",
"site_name": "tasty.co",
"host": "tasty.co",
"language": "en",
"title": "Homemade Cinnamon Rolls Recipe by Tasty",
"ingredients": [
"½ cup unsalted butter, melted",
"2 cups whole milk, warm to the touch",
"½ cup granulated sugar",
"2 ¼ teaspoons active dry yeast",
"5 cups flour, divided",
"1 teaspoon baking powder",
"2 teaspoons salt",
"¾ cup butter, softened",
"¾ cup light brown sugar",
"2 tablespoons ground cinnamon",
"4 oz cream cheese, softened",
"2 tablespoons butter, melted",
"2 tablespoons whole milk",
"1 teaspoon vanilla extract",
"1 cup powdered sugar"
],
"ingredient_groups": [
{
"ingredients": [
"½ cup unsalted butter, melted",
"2 cups whole milk, warm to the touch",
"½ cup granulated sugar",
"2 ¼ teaspoons active dry yeast",
"5 cups flour, divided",
"1 teaspoon baking powder",
"2 teaspoons salt"
],
"purpose": "Dough"
},
{
"ingredients": [
"¾ cup butter, softened",
"¾ cup light brown sugar",
"2 tablespoons ground cinnamon"
],
"purpose": "Filling"
},
{
"ingredients": [
"4 oz cream cheese, softened",
"2 tablespoons butter, melted",
"2 tablespoons whole milk",
"1 teaspoon vanilla extract",
"1 cup powdered sugar"
],
"purpose": "Frosting"
}
],
"instructions_list": [
"Generously butter two disposable foil pie/cake pans.",
"In a large bowl, whisk together warm milk, melted butter, and granulated sugar. The mixture should be just warm, registering between 100-110˚F (37-43˚C). If it is hotter, allow to cool slightly.",
"Sprinkle the yeast evenly over the warm mixture and let set for 1 minute.",
"Add 4 cups (500g) of all-purpose flour to the milk mixture and mix with a wooden spoon until just combined.",
"Cover the bowl with a towel or plastic wrap and set in a warm place to rise for 1 hour.",
"After 1 hour, the dough should have nearly doubled in size.",
"Remove the towel and add an additional ¾ cup (95g) of flour, the baking powder, and salt. Stir well, then turn out onto a well-floured surface.",
"Knead the dough lightly, adding additional flour as necessary, until the dough just loses its stickiness and does not stick to the surface.",
"Roll the dough out into a large rectangle, about ½-inch (1 cm) thick. Fix corners to make sure they are sharp and even.",
"Spread the softened butter evenly over the dough.",
"Sprinkle evenly with brown sugar and a generous sprinkling of cinnamon.",
"Press the mixture into the butter.",
"Roll up the dough, forming a log, and pinch the seam closed. Place seam-side down. Trim off any unevenness on either end.",
"Cut the log in half, then divide each half into 7 evenly sized pieces. About 1½ inches (8cm) thick each.",
"Place 7 cinnamon rolls in each cake pan, one in the center, six around the sides. Cover with plastic wrap and place in a warm place to rise for 30 minutes.",
"Preheat oven to 350˚F (180˚C).",
"To prepare the frosting. In a medium-size mixing bowl, whisk together cream cheese, butter, whole milk, vanilla, and powdered sugar, until smooth.",
"Remove plastic wrap. Bake the cinnamon rolls in a preheated oven for 25-30 minutes, until golden brown.",
"While still warm, drizzle evenly with frosting.",
"Enjoy!"
],
"category": "Desserts",
"yields": "14 servings",
"description": "There's nothing better than waking up to a fresh batch of ooey, gooey cinnamon rolls straight from the oven. This recipe starts with a soft, pillowy dough enriched with butter and milk. The dough is generously sprinkled with a mixture of butter, brown sugar, and cinnamon for a sweet and aromatic filling that will fill your kitchen as it bakes. Once out of the oven, these golden-brown beauties are crowned with a luscious cream cheese icing, adding a tanginess that balances the sweetness perfectly. Homemade cinnamon rolls are a nostalgic indulgence that brings joy to any breakfast or brunch table.",
"total_time": 151,
"cook_time": 30,
"prep_time": 30,
"cuisine": "Cuisine",
"ratings": 4.9,
"ratings_count": 19961,
"nutrients": {
"calories": "479 calories",
"fatContent": "22 grams",
"carbohydrateContent": "63 grams",
"sugarContent": "24 grams",
"proteinContent": "7 grams",
"fiberContent": "1 gram"
},
"image": "https://img.buzzfeed.com/video-api-prod/assets/9d589367531e4c12a4937e30e521c865/fbthumb.jpg?resize=1200:*",
"keywords": [
"bake sale",
"breakfast",
"cinnamon buns",
"cinnamon rolls",
"dessert",
"frosting",
"homemade",
"recipe",
"tasty",
"tasty_vegetarian",
"today food",
"video",
"yeast"
]
}
199 changes: 199 additions & 0 deletions tests/test_data/tasty.co/tasty_2.testhtml

Large diffs are not rendered by default.

0 comments on commit 0c1b257

Please sign in to comment.