-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for theplantbasedschool (#1493)
- Loading branch information
Showing
6 changed files
with
2,990 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from ._abstract import AbstractScraper | ||
from ._grouping_utils import group_ingredients | ||
from ._utils import get_equipment | ||
|
||
|
||
class ThePlantBasedSchool(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "theplantbasedschool.com" | ||
|
||
def ingredient_groups(self): | ||
return group_ingredients( | ||
self.ingredients(), | ||
self.soup, | ||
".wprm-recipe-ingredient-group h4", | ||
".wprm-recipe-ingredient", | ||
) | ||
|
||
def equipment(self): | ||
equipment_items = [ | ||
item.get_text() | ||
for item in self.soup.select( | ||
"li.wprm-recipe-equipment-item div.wprm-recipe-equipment-name" | ||
) | ||
] | ||
return get_equipment(equipment_items) | ||
|
||
def instructions(self): | ||
return "\n".join( | ||
span.get_text() | ||
for instruction in self.soup.select(".wprm-recipe-instruction-text") | ||
for span in instruction.find_all("span", recursive=False) | ||
) |
53 changes: 53 additions & 0 deletions
53
tests/test_data/theplantbasedschool.com/theplantbasedschool_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"author": "Nico Pallotta", | ||
"canonical_url": "https://theplantbasedschool.com/chipotle-sauce/", | ||
"site_name": "The Plant Based School", | ||
"host": "theplantbasedschool.com", | ||
"language": "en-US", | ||
"title": "Chipotle Sauce", | ||
"ingredients": [ | ||
"2 chipotle peppers in adobo sauce (more or less to taste)", | ||
"¾ cup Greek yogurt (sub sourcream or non-dairy yogurt)", | ||
"¼ cup mayonnaise (sub vegan mayo)", | ||
"½ clove garlic", | ||
"1 tablespoon lime juice", | ||
"¼ teaspoon salt", | ||
"1 teaspoon maple syrup (optional)" | ||
], | ||
"instructions_list": [ | ||
"Blend 2 chipotle peppers in adobo sauce, ¼ cup mayonnaise, ¾ cup Greek yogurt, ½ clove garlic, 1 tablespoon lime juice, and ¼ teaspoon salt until smooth and creamy.", | ||
"Scrape down the sides of the blender if necessary. Taste and adjust for salt, sweet, spicy, and acidic.", | ||
"Use chipotle sauce as a dip, spread, or drizzle with veggies, bowls, salads, and Mexican food." | ||
], | ||
"category": "Dressing & Sauces", | ||
"yields": "20 servings", | ||
"description": "Chipotle sauce is a creamy, smokey, and spicy condiment with a touch of sweetness and a bold, umami-packed flavor profile.It's excellent to enhance the taste of salads, bowls, sandwiches, tacos, burritos, and much more.", | ||
"total_time": 5, | ||
"prep_time": 5, | ||
"cuisine": "Mexican-Inspired", | ||
"ratings": 5.0, | ||
"ratings_count": 10, | ||
"equipment": [ | ||
"Blender" | ||
], | ||
"nutrients": { | ||
"servingSize": "1 tbsp", | ||
"calories": "25 kcal", | ||
"fatContent": "2 g", | ||
"saturatedFatContent": "0.2 g", | ||
"carbohydrateContent": "1 g", | ||
"sugarContent": "1 g", | ||
"proteinContent": "0.2 g", | ||
"fiberContent": "0.05 g" | ||
}, | ||
"dietary_restrictions": [ | ||
"Gluten Free Diet", | ||
"Vegan Diet", | ||
"Vegetarian Diet" | ||
], | ||
"image": "https://theplantbasedschool.com/wp-content/uploads/2022/06/chipotle-sauce-recipe-3.jpg", | ||
"keywords": [ | ||
"chipotle", | ||
"jalapeno" | ||
] | ||
} |
990 changes: 990 additions & 0 deletions
990
tests/test_data/theplantbasedschool.com/theplantbasedschool_1.testhtml
Large diffs are not rendered by default.
Oops, something went wrong.
123 changes: 123 additions & 0 deletions
123
tests/test_data/theplantbasedschool.com/theplantbasedschool_2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"author": "Nico Pallotta", | ||
"canonical_url": "https://theplantbasedschool.com/vegan-carrot-cake/", | ||
"site_name": "The Plant Based School", | ||
"host": "theplantbasedschool.com", | ||
"language": "en-US", | ||
"title": "Vegan Carrot Cake", | ||
"ingredients": [ | ||
"2 cups all-purpose flour", | ||
"1 cup brown sugar", | ||
"3 teaspoons cinnamon", | ||
"¼ teaspoon nutmeg", | ||
"¼ teaspoon all spice (optional)", | ||
"1 tablespoon baking powder", | ||
"½ teaspoon baking soda", | ||
"⅛ teaspoon salt", | ||
"¾ cup dairy-free milk (we use almond milk)", | ||
"⅓ cup olive oil (or another vegetable oil)", | ||
"2 teaspoons vanilla extract", | ||
"1 inch ginger (grated)", | ||
"2½ cups carrots (finely grated)", | ||
"¾ cup walnuts (chopped or pulsed in food processor)", | ||
"½ cup raisins", | ||
"2 ounces vegan butter (diced and softened at room temperature)", | ||
"½ lemon (the grated zest)", | ||
"1 teaspoon vanilla extract", | ||
"4 ounces vegan cream cheese", | ||
"1 cup powdered sugar" | ||
], | ||
"ingredient_groups": [ | ||
{ | ||
"ingredients": [ | ||
"2 cups all-purpose flour", | ||
"1 cup brown sugar", | ||
"3 teaspoons cinnamon", | ||
"¼ teaspoon nutmeg", | ||
"¼ teaspoon all spice (optional)", | ||
"1 tablespoon baking powder", | ||
"½ teaspoon baking soda", | ||
"⅛ teaspoon salt" | ||
], | ||
"purpose": "DRY INGREDIENTS" | ||
}, | ||
{ | ||
"ingredients": [ | ||
"¾ cup dairy-free milk (we use almond milk)", | ||
"⅓ cup olive oil (or another vegetable oil)", | ||
"2 teaspoons vanilla extract", | ||
"1 inch ginger (grated)", | ||
"2½ cups carrots (finely grated)" | ||
], | ||
"purpose": "WET INGREDIENTS" | ||
}, | ||
{ | ||
"ingredients": [ | ||
"¾ cup walnuts (chopped or pulsed in food processor)", | ||
"½ cup raisins" | ||
], | ||
"purpose": "ADD-INS" | ||
}, | ||
{ | ||
"ingredients": [ | ||
"2 ounces vegan butter (diced and softened at room temperature)", | ||
"½ lemon (the grated zest)", | ||
"1 teaspoon vanilla extract", | ||
"4 ounces vegan cream cheese", | ||
"1 cup powdered sugar" | ||
], | ||
"purpose": "FROSTING" | ||
} | ||
], | ||
"instructions_list": [ | ||
"Preheat oven to 340°F or 170°C. Butter the sides of your pan and line the bottom with parchment paper.", | ||
"Peel, then grate 2½ cups carrots with a food processor with grating disk attachment or with the small holes of a box grater. Set aside.", | ||
"To a large bowl, add 2 cups all-purpose flour, 1 cup brown sugar, 3 teaspoons cinnamon, ¼ teaspoon nutmeg, ¼ teaspoon all spice, 1 tablespoon baking powder, ½ teaspoon baking soda, and ⅛ teaspoon salt.", | ||
"Whisk well.", | ||
"To the same bowl, add ¾ cup dairy-free milk, ⅓ cup olive oil, 2 teaspoons vanilla extract, 1 inch ginger (peeled and grated), and stir with a spoon/spatula until barely combined. ", | ||
"Don't overmix it. Batter should be pretty thick.", | ||
"Fold in the grated carrots, ¾ cup walnuts (chopped), and ½ cup raisins.", | ||
"The batter should be pretty thick as the carrots release moisture while baking.", | ||
"Pour the mixture into the prepared pan.", | ||
"Bake at 340°F or 170°C for 45 to 55 minutes, or until a toothpick inserted in the center comes out dry.", | ||
"Let cool down in the pan for 15 minutes, then transfer it onto a wire rack and cool down completely, or for about 2 to 3 hours.", | ||
"Add 2 ounces vegan butter (softened at room temperature), ½ lemon (the grated zest), and 1 teaspoon vanilla extract to a bowl. ", | ||
"Beat with a hand mixer until creamy.", | ||
"Add 4 ounces vegan cream cheese and beat until combined, then add 1 cup powdered sugar and beat until smooth and creamy.", | ||
"Apply frosting on top of the carrot cake, cut into squares and enjoy. ", | ||
"You can garnish with crushed walnuts." | ||
], | ||
"category": "Breakfast,Dessert,Snack", | ||
"yields": "16 servings", | ||
"description": "Our vegan carrot cake is an easy-to-make one-layer cake with simple ingredients you already have in your pantry.You’ll love this recipe because you can put it together with little effort; it’s perfectly moist, tender, and packed with flavor thanks to the carrots, walnuts, cinnamon, nutmeg, and allspice.", | ||
"total_time": 65, | ||
"cook_time": 50, | ||
"prep_time": 15, | ||
"cuisine": "American", | ||
"ratings": 5.0, | ||
"ratings_count": 58, | ||
"equipment": [ | ||
"Box grater with small holes or food processor with grating disk attachment.", | ||
"8-Inch square baking pan (20 cm) or 9-Inch square baking pan (23 cm), 9-Inch round cake pan (23 cm), or 11×7 rectangular baking dish (28 x 18 cm)." | ||
], | ||
"nutrients": { | ||
"servingSize": "1 serving", | ||
"calories": "295 kcal", | ||
"fatContent": "13 g", | ||
"saturatedFatContent": "2 g", | ||
"unsaturatedFatContent": "9 g", | ||
"carbohydrateContent": "42 g", | ||
"sugarContent": "24 g", | ||
"proteinContent": "4 g", | ||
"fiberContent": "2 g" | ||
}, | ||
"dietary_restrictions": [ | ||
"Vegan Diet", | ||
"Vegetarian Diet" | ||
], | ||
"image": "https://theplantbasedschool.com/wp-content/uploads/2022/11/Carrot-cake-frosting-1.jpg", | ||
"keywords": [ | ||
"carrot cake", | ||
"carrots" | ||
] | ||
} |
Oops, something went wrong.