Skip to content

Commit

Permalink
Add support for mykoreankitchen.com (#1094)
Browse files Browse the repository at this point in the history
  • Loading branch information
a1831319 authored May 6, 2024
1 parent 94b2617 commit 566a4a9
Show file tree
Hide file tree
Showing 5 changed files with 1,611 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ Scrapers available for:
- `https://myjewishlearning.com/ <https://myjewishlearning.com>`_
- `https://mykitchen101.com/ <https://mykitchen101.com>`_
- `https://mykitchen101en.com/ <https://mykitchen101en.com>`_
- `https://mykoreankitchen.com/ <https://mykoreankitchen.com>`_
- `https://www.myplate.gov/ <https://www.myplate.gov/>`_
- `https://myrecipes.com/ <https://myrecipes.com>`_
- `https://healthyeating.nhlbi.nih.gov/ <https://healthyeating.nhlbi.nih.gov>`_
Expand Down
2 changes: 2 additions & 0 deletions recipe_scrapers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
from .myjewishlearning import MyJewishLearning
from .mykitchen101 import MyKitchen101
from .mykitchen101en import MyKitchen101en
from .mykoreankitchen import MyKoreanKitchen
from .myrecipes import MyRecipes
from .nhshealthierfamilies import NHSHealthierFamilies
from .nibbledish import NibbleDish
Expand Down Expand Up @@ -407,6 +408,7 @@
Moulinex.host(): Moulinex,
MundoDeReceitasBimby.host(): MundoDeReceitasBimby,
MyJewishLearning.host(): MyJewishLearning,
MyKoreanKitchen.host(): MyKoreanKitchen,
NutritionFacts.host(): NutritionFacts,
PinchOfYum.host(): PinchOfYum,
PotatoRolls.host(): PotatoRolls,
Expand Down
83 changes: 83 additions & 0 deletions recipe_scrapers/mykoreankitchen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# mypy: allow-untyped-defs

from recipe_scrapers._grouping_utils import IngredientGroup

from ._abstract import AbstractScraper


class MyKoreanKitchen(AbstractScraper):
@classmethod
def host(cls):
return "mykoreankitchen.com"

def author(self):
return self.schema.author()

def title(self):
return self.schema.title()

def category(self):
return self.schema.category()

def total_time(self):
return self.schema.total_time()

def yields(self):
return self.schema.yields()

def image(self):
return self.schema.image()

def ingredients(self):
return self.schema.ingredients()

def ingredient_groups(self):
ingredient_groups = self.soup.find_all(
"div", {"class": "wprm-recipe-ingredient-group"}
)

results = []
ingredient_index_base = 0

for ingredient_group in ingredient_groups:

ingredient_count = (
len(ingredient_group.find_all("li")) + ingredient_index_base
)

purpose_heading = ingredient_group.find(
"h4", "wprm-recipe-ingredient-group-name"
)
results.append(
IngredientGroup(
ingredients=[
ingredient
for ingredient in self.schema.ingredients()[
ingredient_index_base:ingredient_count
]
],
purpose=purpose_heading.text if purpose_heading else None,
)
)

ingredient_index_base = ingredient_count

return results

def instructions(self):
return self.schema.instructions()

def ratings(self):
return self.schema.ratings()

def cuisine(self):
return self.schema.cuisine()

def description(self):
return self.schema.description()

def cook_time(self):
return self.schema.cook_time()

def prep_time(self):
return self.schema.prep_time()
90 changes: 90 additions & 0 deletions tests/test_data/mykoreankitchen.com/mykoreankitchen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"author": "Sue | My Korean Kitchen",
"canonical_url": "https://mykoreankitchen.com/korean-sweet-rice-with-dried-fruit-and-nuts/",
"host": "mykoreankitchen.com",
"description": "Korean sweet rice dessert (Yaksik) recipe",
"image": "https://mykoreankitchen.com/wp-content/uploads/2016/01/1.-Korean-Sweet-Rice-with-Dried-Fruit-and-Nuts.jpg",
"ingredients": [
"3 cups* sweet rice (short grain glutinous rice)",
"2 cups* water",
"2 Tbsp pine nuts",
"15 chestnuts",
"1/4 cup raisins",
"1/4 cup dried cranberries",
"10 pitted dried jujube (red dates – rinsed and halved)",
"1/3 cup dark brown sugar",
"1 Tbsp soy sauce",
"2 Tbsp honey",
"2 Tbsp sesame oil",
"1/2 tsp cinnamon powder",
"1/8 tsp fine sea salt",
"1 Tbsp pine nuts",
"2 to 3 pitted dried jujube"
],
"ingredient_groups": [
{
"ingredients": [
"3 cups* sweet rice (short grain glutinous rice)",
"2 cups* water",
"2 Tbsp pine nuts",
"15 chestnuts",
"1/4 cup raisins",
"1/4 cup dried cranberries",
"10 pitted dried jujube (red dates – rinsed and halved)"
],
"purpose": "Main"
},
{
"ingredients": [
"1/3 cup dark brown sugar",
"1 Tbsp soy sauce",
"2 Tbsp honey",
"2 Tbsp sesame oil",
"1/2 tsp cinnamon powder",
"1/8 tsp fine sea salt"
],
"purpose": "Seasoning sauce (mix these in a bowl)"
},
{
"ingredients": [
"1 Tbsp pine nuts",
"2 to 3 pitted dried jujube"
],
"purpose": "Decoration (number of required ingredients will vary depending on the size of each bar piece.)"
}
],
"instructions": "Combine the seasoning sauce ingredients in a bowl and mix them well.\nRinse the sweet rice under cold running water a couple of times until the water runs clear. Drain the water and allow the rice to sit in the sieve for 10 to 20 minutes to ensure it's fully drained.\nAdd the sweet rice, the water and the seasoning sauce into the rice cooker or multi cooker pot and mix them well.\nAdd the nuts and dried fruit on top. Mix them well to make sure these are evenly spread in the pot.\n(For Rice Cooker) Set the “multi steam” function for 35 mins and cook. - This is based on my cuckoo rice cooker setting. (For Instant Pot) Select the ‘rice’ setting and set it to ‘high pressure’. Make sure the steam release handle is in the ‘sealing’ position. The Instant Pot will automatically adjust the cooking duration. Upon completion of the cooking cycle (approximately 20 minutes), cautiously shift the steam release handle from 'sealing' to 'venting'.\nPrepare a medium-sized square or rectangular container for molding. I used a Pyrex container, but a baking tray works well too. Optionally, you can cover the mold with cling wrap to make it easier to remove the rice later. Once everything is cooked, gently stir and mix the rice, dried fruit, and nuts using a rice scoop. Then, transfer the rice mixture into your prepared mold. Press this mixture down firmly to make sure it's packed tightly. Finally, allow the rice to cool in the mold for 20 to 30 minutes.\nTip the mold over the cutting board or gently lift the cling wrap to release the yaksik. If you wish, you can garnish the yaksik with pine nuts and sliced jujube, spacing them out generously. (Decoration is optional. Before you start decorating, envision the size of each cut portion to ensure there is enough room for both decoration and slicing. If you plan to make smaller food portions, you'll need to spend more time on decoration.)\nSlice the yaksik into your preferred size. (If you decorated, that will influence the size.)\nServe the yaksik. If not consuming immediately, wrap each piece individually in food wrap, store them in a container, and refrigerate it for a few days or freeze it for up to a few months.",
"instructions_list": [
"Combine the seasoning sauce ingredients in a bowl and mix them well.",
"Rinse the sweet rice under cold running water a couple of times until the water runs clear. Drain the water and allow the rice to sit in the sieve for 10 to 20 minutes to ensure it's fully drained.",
"Add the sweet rice, the water and the seasoning sauce into the rice cooker or multi cooker pot and mix them well.",
"Add the nuts and dried fruit on top. Mix them well to make sure these are evenly spread in the pot.",
"(For Rice Cooker) Set the “multi steam” function for 35 mins and cook. - This is based on my cuckoo rice cooker setting. (For Instant Pot) Select the ‘rice’ setting and set it to ‘high pressure’. Make sure the steam release handle is in the ‘sealing’ position. The Instant Pot will automatically adjust the cooking duration. Upon completion of the cooking cycle (approximately 20 minutes), cautiously shift the steam release handle from 'sealing' to 'venting'.",
"Prepare a medium-sized square or rectangular container for molding. I used a Pyrex container, but a baking tray works well too. Optionally, you can cover the mold with cling wrap to make it easier to remove the rice later. Once everything is cooked, gently stir and mix the rice, dried fruit, and nuts using a rice scoop. Then, transfer the rice mixture into your prepared mold. Press this mixture down firmly to make sure it's packed tightly. Finally, allow the rice to cool in the mold for 20 to 30 minutes.",
"Tip the mold over the cutting board or gently lift the cling wrap to release the yaksik. If you wish, you can garnish the yaksik with pine nuts and sliced jujube, spacing them out generously. (Decoration is optional. Before you start decorating, envision the size of each cut portion to ensure there is enough room for both decoration and slicing. If you plan to make smaller food portions, you'll need to spend more time on decoration.)",
"Slice the yaksik into your preferred size. (If you decorated, that will influence the size.)",
"Serve the yaksik. If not consuming immediately, wrap each piece individually in food wrap, store them in a container, and refrigerate it for a few days or freeze it for up to a few months."
],
"language": "en-US",
"site_name": "My Korean Kitchen",
"title": "Yaksik (Korean Sweet Rice with Dried Fruit and Nuts)",
"total_time": 70,
"prep_time": 10,
"cook_time": 60,
"ratings": 4.88,
"yields": "9 servings",
"category": "Dessert",
"cuisine": "Korean",
"nutrients": {
"calories": "439 kcal",
"carbohydrateContent": "89 g",
"proteinContent": "6 g",
"fatContent": "7 g",
"saturatedFatContent": "1 g",
"sodiumContent": "151 mg",
"fiberContent": "3 g",
"sugarContent": "14 g",
"unsaturatedFatContent": "5 g",
"servingSize": "1 serving"
}
}
1,435 changes: 1,435 additions & 0 deletions tests/test_data/mykoreankitchen.com/mykoreankitchen.testhtml

Large diffs are not rendered by default.

0 comments on commit 566a4a9

Please sign in to comment.