-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: README.rst recipe_scrapers/__init__.py recipe_scrapers/__version__.py
- Loading branch information
Showing
123 changed files
with
71,175 additions
and
5,639 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
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,28 @@ | ||
from ._abstract import AbstractScraper | ||
from ._grouping_utils import group_ingredients | ||
from ._utils import get_equipment | ||
|
||
|
||
class ABeautifulMess(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "abeautifulmess.com" | ||
|
||
def ingredient_groups(self): | ||
return group_ingredients( | ||
self.ingredients(), | ||
self.soup, | ||
".wprm-recipe-ingredient-group h4", | ||
".wprm-recipe-ingredient", | ||
) | ||
|
||
def equipment(self): | ||
equipment_container = self.soup.select_one(".wprm-recipe-equipment-container") | ||
if not equipment_container: | ||
return None | ||
|
||
equipment_items = [ | ||
item.get_text() | ||
for item in equipment_container.select(".wprm-recipe-equipment-name") | ||
] | ||
return get_equipment(equipment_items) |
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,57 @@ | ||
from ._abstract import AbstractScraper | ||
from ._grouping_utils import group_ingredients | ||
|
||
|
||
class BarefootInThePines(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "barefootinthepines.com" | ||
|
||
def ingredient_groups(self): | ||
return group_ingredients( | ||
self.ingredients(), | ||
self.soup, | ||
".mv-create-ingredients h4", | ||
".mv-create-ingredients ul li", | ||
) | ||
|
||
def nutrients(self): | ||
nutrition_section = self.soup.select_one(".mv-create-nutrition-box") | ||
if not nutrition_section: | ||
return None | ||
|
||
raw_nutrition_data = { | ||
item.select_one(".mv-create-nutrition-label") | ||
.get_text(strip=True) | ||
.lower() | ||
.rstrip(":"): item.get_text(strip=True) | ||
.replace( | ||
item.select_one(".mv-create-nutrition-label").get_text(strip=True), "" | ||
) | ||
.strip() | ||
for item in nutrition_section.select(".mv-create-nutrition-item") | ||
if item.select_one(".mv-create-nutrition-label") | ||
} | ||
|
||
nutrition_label_mapping = { | ||
"calories": "calories", | ||
"carbohydrates": "carbohydrateContent", | ||
"cholesterol": "cholesterolContent", | ||
"total fat": "fatContent", | ||
"fiber": "fiberContent", | ||
"protein": "proteinContent", | ||
"saturated fat": "saturatedFatContent", | ||
"serving size": "servingSize", | ||
"sodium": "sodiumContent", | ||
"sugar": "sugarContent", | ||
"trans fat": "transFatContent", | ||
"unsaturated fat": "unsaturatedFatContent", | ||
} | ||
|
||
standardized_nutrition_data = { | ||
nutrition_label_mapping[custom_label]: value | ||
for custom_label, value in raw_nutrition_data.items() | ||
if custom_label in nutrition_label_mapping | ||
} | ||
|
||
return standardized_nutrition_data |
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 BetterFoodGuru(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "betterfoodguru.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,28 @@ | ||
from ._abstract import AbstractScraper | ||
from ._grouping_utils import group_ingredients | ||
from ._utils import get_equipment | ||
|
||
|
||
class BeyondFrosting(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "beyondfrosting.com" | ||
|
||
def ingredient_groups(self): | ||
return group_ingredients( | ||
self.ingredients(), | ||
self.soup, | ||
".tasty-recipes-ingredients-body p strong", | ||
".tasty-recipes-ingredients-body ul li", | ||
) | ||
|
||
def equipment(self): | ||
equipment_items = self.soup.select( | ||
".tasty-recipes-equipment .tasty-link-card a.tasty-link" | ||
) | ||
equipment_list = [ | ||
item.find_next("p").get_text(strip=True) | ||
for item in equipment_items | ||
if "affiliate link" not in item.find_next("p").get_text(strip=True).lower() | ||
] | ||
return get_equipment(equipment_list) |
Oops, something went wrong.