Skip to content

Commit

Permalink
Adds support for hungryhappens (#1278)
Browse files Browse the repository at this point in the history
* hungryhappens

* Update recipe_scrapers/hungryhappens.py

Co-authored-by: James Addison <55152140+jayaddison@users.noreply.github.com>

---------

Co-authored-by: James Addison <55152140+jayaddison@users.noreply.github.com>
  • Loading branch information
jknndy and jayaddison authored Oct 15, 2024
1 parent 4f3f371 commit 09df317
Show file tree
Hide file tree
Showing 7 changed files with 1,969 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ Scrapers available for:
- `https://www.hersheyland.com/ <https://www.hersheyland.com/>`_
- `https://www.homechef.com/ <https://www.homechef.com/>`_
- `https://hostthetoast.com/ <https://hostthetoast.com/>`_
- `https://hungryhappens.net/ <https://hungryhappens.net/>`_
- `https://www.ica.se/ <https://www.ica.se/>`_
- `https://www.im-worthy.com/ <https://www.im-worthy.com>`_
- `https://inbloombakery.com/ <https://inbloombakery.com/>`_
Expand Down
2 changes: 2 additions & 0 deletions recipe_scrapers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
from .hersheyland import HersheyLand
from .homechef import HomeChef
from .hostthetoast import Hostthetoast
from .hungryhappens import HungryHappens
from .ica import Ica
from .ig import IG
from .imworthy import ImWorthy
Expand Down Expand Up @@ -511,6 +512,7 @@
GourmetTraveller.host(): GourmetTraveller,
GrandFrais.host(): GrandFrais,
HeatherChristo.host(): HeatherChristo,
HungryHappens.host(): HungryHappens,
InBloomBakery.host(): InBloomBakery,
InGoodFlavor.host(): InGoodFlavor,
JoCooks.host(): JoCooks,
Expand Down
29 changes: 29 additions & 0 deletions recipe_scrapers/hungryhappens.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from ._abstract import AbstractScraper
from ._grouping_utils import group_ingredients
from ._utils import get_equipment


class HungryHappens(AbstractScraper):
@classmethod
def host(cls):
return "hungryhappens.net"

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.select_one(".wprm-recipe-equipment-name").get_text(strip=True)
for item in equipment_container.select(".wprm-recipe-equipment-item")
if item.select_one(".wprm-recipe-equipment-name")
]
return get_equipment(equipment_items)
55 changes: 55 additions & 0 deletions tests/test_data/hungryhappens.net/hungryhappens_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"author": "Stella",
"canonical_url": "https://hungryhappens.net/one-pot-vegetable-tortellini-soup/",
"site_name": "Hungry Happens",
"host": "hungryhappens.net",
"language": "en-US",
"title": "One Pot Vegetable Tortellini Soup",
"ingredients": [
"1/4 cup olive oil",
"1 medium sweet onion, (diced)",
"4 medium carrots, (diced)",
"12 oz mushrooms, (diced)",
"4 celery ribs, (diced)",
"4 cloves garlic, (minced)",
"1 tsp paprika",
"1 tbs Italian herb seasoning",
"salt and pepper (to taste)",
"2 tbs tomato paste",
"1/2 cup dry white wine",
"7 cups low sodium vegetable or chicken broth",
"1½ lb cheese tortellini",
"1/2 cup grated parmesan cheese",
"1/2 cup heavy cream",
"3 handfuls kale, (chopped)"
],
"instructions_list": [
"In a large pot, heat your oil on high. Once hot, add in the carrots and onion to saute for 3 minutes. Add in the mushrooms and celery and mix to combine and saute all for another few minutes. Next stir in the garlic for 30 seconds.",
"Add in the paprika, Italian herb seasonings, salt and pepper to taste and tomato paste and stir to coat all. Next add in the wine and broth and bring to a boil. Simmer covered for 20 minutes or until the carrots are tender.",
"Add in the tortellini and grated parmesan and boil for 5 minutes. Lastly stir in the heavy cream and kale - gently.",
"Optional: Top with freshly grated parmesan, a light drizzle of olive oil and enjoy!"
],
"yields": "4 servings",
"total_time": 45,
"cook_time": 30,
"prep_time": 15,
"ratings": 4.96,
"ratings_count": 68,
"equipment": [
"large pot"
],
"nutrients": {
"servingSize": "1 serving",
"calories": "944 kcal",
"fatContent": "43 g",
"saturatedFatContent": "16 g",
"unsaturatedFatContent": "15 g",
"carbohydrateContent": "101 g",
"sugarContent": "18 g",
"proteinContent": "37 g",
"sodiumContent": "1100 mg",
"fiberContent": "13 g",
"cholesterolContent": "109 mg"
},
"image": "https://hungryhappens.net/wp-content/uploads/2022/12/IMG_2810-scaled.jpeg"
}
997 changes: 997 additions & 0 deletions tests/test_data/hungryhappens.net/hungryhappens_1.testhtml

Large diffs are not rendered by default.

88 changes: 88 additions & 0 deletions tests/test_data/hungryhappens.net/hungryhappens_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"author": "Stella",
"canonical_url": "https://hungryhappens.net/crispy-salmon-tacos/",
"site_name": "Hungry Happens",
"host": "hungryhappens.net",
"language": "en-US",
"title": "Crispy Salmon Tacos",
"ingredients": [
"1/2 head green cabbage, (fine shredded)",
"1/2 large cucumber",
"3 tbs dill, (chopped)",
"1/4 cup champagne vinegar ((or white wine vinegar))",
"salt and pepper (to taste)",
"3 avocadoes",
"2 tsp Sriracha sauce",
"1 lime, (juiced)",
"salt and pepper (to taste)",
"2 lbs salmon, (skin removed)",
"2 tsp chipotle powder ((or chili powder))",
"1 tsp onion powder",
"1 tsp dried oregano",
"1 lime, (zested + juiced)",
"8 small corn tortillas"
],
"ingredient_groups": [
{
"ingredients": [
"1/2 head green cabbage, (fine shredded)",
"1/2 large cucumber",
"3 tbs dill, (chopped)",
"1/4 cup champagne vinegar ((or white wine vinegar))",
"salt and pepper (to taste)"
],
"purpose": "Slaw:"
},
{
"ingredients": [
"3 avocadoes",
"2 tsp Sriracha sauce",
"1 lime, (juiced)",
"salt and pepper (to taste)"
],
"purpose": "Spicy Avocado Mash:"
},
{
"ingredients": [
"2 lbs salmon, (skin removed)",
"2 tsp chipotle powder ((or chili powder))",
"1 tsp onion powder",
"1 tsp dried oregano",
"1 lime, (zested + juiced)",
"8 small corn tortillas"
],
"purpose": "Salmon:"
}
],
"instructions_list": [
"Slaw:",
"Leave the skin on your cucumber. Slice your cucumber in half lengthwise. Remove seeds and then slice thin.",
"Mix everyhting in a large bowl, cover and place in your fridge while you make everything else.",
"Avocado Mash:",
"In a medium bowl, rough mash your avocados. Add in the rest of the ingredients and mix to combine. Taste and adjust the sriracha if needed.",
"Salmon:",
"Pat your fish dry with paper towel. Slice the filet into large chunks. Transfer to a bowl and mix with the seasonings, lime zest and juice to coat.",
"In a large skillet, working in two batches, add 1/2 tbs olive oil. Once pan is hot add in the salmon pieces and cook until crispy and done. Remove to a plate lined with paper towel. Wipe the pan clean and repeat with the rest of the salmon.",
"Heat your tortillas in a pan or wrapped in a stack, in aluminum foil in your small toaster oven."
],
"yields": "4 servings",
"total_time": 30,
"cook_time": 10,
"prep_time": 20,
"ratings": 4.94,
"ratings_count": 32,
"nutrients": {
"servingSize": "1 serving",
"calories": "728 kcal",
"fatContent": "38 g",
"saturatedFatContent": "6 g",
"unsaturatedFatContent": "29 g",
"carbohydrateContent": "48 g",
"sugarContent": "6 g",
"proteinContent": "53 g",
"sodiumContent": "200 mg",
"fiberContent": "18 g",
"cholesterolContent": "125 mg"
},
"image": "https://hungryhappens.net/wp-content/uploads/2022/04/JPEG-image-110-scaled.jpeg"
}
Loading

0 comments on commit 09df317

Please sign in to comment.