-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for celebratingsweets.com, ingoodflavor.com, kitchenaid.c…
…om.au, leitesculinaria.com, myvegetarianroots.com, peelwithzeal.com and sandwichtribunal.com (#1196)
- Loading branch information
Showing
35 changed files
with
17,696 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
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,16 @@ | ||
from ._abstract import AbstractScraper | ||
from ._grouping_utils import group_ingredients | ||
|
||
|
||
class CelebratingSweets(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "celebratingsweets.com" | ||
|
||
def ingredient_groups(self): | ||
return group_ingredients( | ||
self.ingredients(), | ||
self.soup, | ||
".wprm-recipe-ingredient-group h4", | ||
".wprm-recipe-ingredient", | ||
) |
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,31 @@ | ||
from ._abstract import AbstractScraper | ||
from ._grouping_utils import group_ingredients | ||
|
||
|
||
class InGoodFlavor(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "ingoodflavor.com" | ||
|
||
def author(self): | ||
signature_div = self.soup.find("div", class_="text-signature") | ||
signature_text = signature_div.get_text(strip=True) if signature_div else None | ||
schema_author = self.schema.author() | ||
|
||
if signature_text and schema_author: | ||
return f"{signature_text} | {schema_author}" | ||
return schema_author | ||
|
||
def ingredient_groups(self): | ||
groups = group_ingredients( | ||
self.ingredients(), | ||
self.soup, | ||
".dr-title", | ||
".dr-ingredient-name", | ||
) | ||
|
||
for group in groups: | ||
if group.purpose and group.purpose.strip().lower() == "ingredients": | ||
group.purpose = None | ||
|
||
return groups |
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,16 @@ | ||
from ._abstract import AbstractScraper | ||
from ._grouping_utils import group_ingredients | ||
|
||
|
||
class KitchenDreaming(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "kitchendreaming.com" | ||
|
||
def ingredient_groups(self): | ||
return group_ingredients( | ||
self.ingredients(), | ||
self.soup, | ||
".wprm-recipe-ingredient-group-name", | ||
".wprm-recipe-ingredient", | ||
) |
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,16 @@ | ||
from ._abstract import AbstractScraper | ||
from ._grouping_utils import group_ingredients | ||
|
||
|
||
class LeitesCulinaria(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "leitesculinaria.com" | ||
|
||
def ingredient_groups(self): | ||
return group_ingredients( | ||
self.ingredients(), | ||
self.soup, | ||
".wprm-recipe-group-name", | ||
".wprm-recipe-ingredient", | ||
) |
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,16 @@ | ||
from ._abstract import AbstractScraper | ||
from ._grouping_utils import group_ingredients | ||
|
||
|
||
class MyVegetarianRoots(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "myvegetarianroots.com" | ||
|
||
def ingredient_groups(self): | ||
return group_ingredients( | ||
self.ingredients(), | ||
self.soup, | ||
".wprm-recipe-ingredient-group h4", | ||
".wprm-recipe-ingredient", | ||
) |
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,25 @@ | ||
from ._abstract import AbstractScraper | ||
from ._grouping_utils import group_ingredients | ||
from ._utils import get_equipment | ||
|
||
|
||
class PeelWithZeal(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "peelwithzeal.com" | ||
|
||
def equipment(self): | ||
equipment_items = [ | ||
equip.get_text() | ||
for equip in self.soup.find_all("div", class_="wprm-recipe-equipment-name") | ||
if equip.get_text() | ||
] | ||
return get_equipment(equipment_items) | ||
|
||
def ingredient_groups(self): | ||
return group_ingredients( | ||
self.ingredients(), | ||
self.soup, | ||
".wprm-recipe-ingredient-group h4", | ||
".wprm-recipe-ingredient", | ||
) |
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,7 @@ | ||
from ._abstract import AbstractScraper | ||
|
||
|
||
class SandwhichTribunal(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "sandwichtribunal.com" |
50 changes: 50 additions & 0 deletions
50
tests/test_data/celebratingsweets.com/celebratingsweets_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,50 @@ | ||
{ | ||
"author": "Allison", | ||
"canonical_url": "https://celebratingsweets.com/berries-and-cream-trifle/", | ||
"site_name": "Celebrating Sweets", | ||
"host": "celebratingsweets.com", | ||
"language": "en-US", | ||
"title": "Berry Trifle", | ||
"ingredients": [ | ||
"2 1/2 cups cold heavy cream", | ||
"1/2 cup powdered sugar", | ||
"1 1/2 teaspoons pure vanilla extract", | ||
"1/4 teaspoon almond extract", | ||
"8 - 10 cups cubed pound cake or angel food cake (see note)", | ||
"16 ounces strawberries (sliced)", | ||
"6 ounces raspberries", | ||
"6 ounces blackberries", | ||
"6 ounces blueberries", | ||
"1/2 cup raspberry or strawberry jam (heated just enough to make it pourable (not hot))" | ||
], | ||
"instructions": "With a hand mixer or stand mixer fitted with a whisk attachment, beat heavy cream*, powdered sugar, vanilla and almond extract until soft peaks form, this will take several minutes. Keep the whipped cream refrigerated while you assemble the other components of the recipe.\nIn a large trifle dish (or individual glasses), layer the cake, whipped cream, berries, and jam. You can layer it anyway you like. I did the following (from the bottom up): whipped cream, cake, berries, whipped cream, cake, jam, whipped cream, berries.", | ||
"instructions_list": [ | ||
"With a hand mixer or stand mixer fitted with a whisk attachment, beat heavy cream*, powdered sugar, vanilla and almond extract until soft peaks form, this will take several minutes. Keep the whipped cream refrigerated while you assemble the other components of the recipe.", | ||
"In a large trifle dish (or individual glasses), layer the cake, whipped cream, berries, and jam. You can layer it anyway you like. I did the following (from the bottom up): whipped cream, cake, berries, whipped cream, cake, jam, whipped cream, berries." | ||
], | ||
"category": "Dessert", | ||
"yields": "10 servings", | ||
"description": "This easy trifle includes layers of cake, fresh berries, and whipped cream. Take a shortcut with store bought pound cake or angel food cake, or make your own. You'll love this simple and beautiful red, white, and blue dessert!", | ||
"total_time": 25, | ||
"cook_time": 5, | ||
"prep_time": 25, | ||
"cuisine": "Dessert", | ||
"ratings": 5.0, | ||
"ratings_count": 8, | ||
"nutrients": { | ||
"calories": "399 kcal", | ||
"carbohydrateContent": "46 g", | ||
"proteinContent": "5 g", | ||
"fatContent": "22 g", | ||
"saturatedFatContent": "13 g", | ||
"cholesterolContent": "81 mg", | ||
"sodiumContent": "279 mg", | ||
"fiberContent": "3 g", | ||
"sugarContent": "26 g", | ||
"servingSize": "1 serving" | ||
}, | ||
"image": "https://celebratingsweets.com/wp-content/uploads/2015/06/Berries-Cream-Trifle-2.jpg", | ||
"keywords": [ | ||
"Trifle" | ||
] | ||
} |
Oops, something went wrong.