Skip to content

Commit

Permalink
Reapply "Adds support for kalejunkie.com (#1204)"
Browse files Browse the repository at this point in the history
This reverts commit 4073321.
  • Loading branch information
jayaddison committed Aug 26, 2024
1 parent 6163e49 commit 9069f9b
Show file tree
Hide file tree
Showing 7 changed files with 7,975 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ Scrapers available for:
- `https://justataste.com/ <https://justataste.com>`_
- `https://justbento.com/ <https://justbento.com>`_
- `https://www.justonecookbook.com/ <https://www.justonecookbook.com>`_
- `https://kalejunkie.com/ <https://kalejunkie.com/>`_
- `https://kennymcgovern.com/ <https://kennymcgovern.com>`_
- `https://keukenliefde.nl/ <https://keukenliefde.nl>`_
- `https://www.kingarthurbaking.com <https://www.kingarthurbaking.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 @@ -185,6 +185,7 @@
from .justataste import JustATaste
from .justbento import JustBento
from .justonecookbook import JustOneCookbook
from .kalejunkie import KaleJunkie
from .kennymcgovern import KennyMcGovern
from .keukenliefdenl import KeukenLiefdeNL
from .kingarthur import KingArthur
Expand Down Expand Up @@ -470,6 +471,7 @@
JoCooks.host(): JoCooks,
JoshuaWeissman.host(): JoshuaWeissman,
JoyTheBaker.host(): JoyTheBaker,
KaleJunkie.host(): KaleJunkie,
KitchenAidAustralia.host(): KitchenAidAustralia,
KristinesKitchenBlog.host(): KristinesKitchenBlog,
KuchynaLidla.host(): KuchynaLidla,
Expand Down
23 changes: 23 additions & 0 deletions recipe_scrapers/kalejunkie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from ._abstract import AbstractScraper
from ._grouping_utils import group_ingredients


class KaleJunkie(AbstractScraper):
@classmethod
def host(cls):
return "kalejunkie.com"

def ingredient_groups(self):
return group_ingredients(
self.ingredients(),
self.soup,
".wprm-recipe-ingredient-group h4",
".wprm-recipe-ingredient",
)

def instructions(self):
instructions = self.soup.findAll(
"div", {"class": "wprm-recipe-instruction-text"}
)

return "\n".join([instruction.get_text() for instruction in instructions])
40 changes: 40 additions & 0 deletions tests/test_data/kalejunkie.com/kalejunkie_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"author": "Nicole Modic",
"canonical_url": "https://kalejunkie.com/one-pan-marry-me-chicken-orzo/",
"site_name": "KaleJunkie",
"host": "kalejunkie.com",
"language": "en-US",
"title": "One-Pan \"Marry Me\" Chicken Orzo",
"ingredients": [
"1.5 Pounds Boneless, Skinless Chicken breast (cut into cubes)",
"2 Tablespoons Olive Oil",
"4-5 Cloves Garlic (mashed)",
"3/4 Cup Sun-Dried Tomatoes (packed in oil and drained)",
"2 Teaspoons Italian seasoning",
"2 Teaspoons Paprika",
"1/2 Teaspoon Kosher Salt",
"1 Teaspoon Ground Black Pepper",
"1 Cup Orzo",
"2 3/4 Cups Chicken Broth or Water",
"3/4 Cup Full-Fat Coconut Milk or Heavy Cream",
"2 Large Handfuls Fresh Spinach",
"3/4 Cup Parmesan Cheese (freshly grated)"
],
"instructions": "To make this recipe, start by preparing the chicken. Pat the chicken breasts dry with a paper towel and slice them into cubes. Set them aside while you prepare the skillet.\nHeat a skillet, on the stove, over medium heat, and add in the oil.\nOnce the oil is hot, add in the chicken and cook for 2-3 minutes, until the edges start to cook.\nThen, add in the sun-dried tomatoes, garlic, italian seasoning, paprika, sea salt, and black pepper, and cook for 3-4 more minutes.\nThen, add in the orzo and broth and stir well.\nReduce the heat to medium, then cover the pan and allow it to cook for 12 minutes. Remove the cover every few minutes and stir, to ensure that the orzo doesn't stick to the bottom of the pan.\nOnce the orzo is cooked through, add in the coconut milk or heavy cream and spinach and stir until the spinach is wilted.\nFinally, add in the freshly-grated parmesan cheese and stir one last time.\nOnce it's done, remove it from the heat, serve it immediately, and enjoy!",
"instructions_list": [
"To make this recipe, start by preparing the chicken. Pat the chicken breasts dry with a paper towel and slice them into cubes. Set them aside while you prepare the skillet.",
"Heat a skillet, on the stove, over medium heat, and add in the oil.",
"Once the oil is hot, add in the chicken and cook for 2-3 minutes, until the edges start to cook.",
"Then, add in the sun-dried tomatoes, garlic, italian seasoning, paprika, sea salt, and black pepper, and cook for 3-4 more minutes.",
"Then, add in the orzo and broth and stir well.",
"Reduce the heat to medium, then cover the pan and allow it to cook for 12 minutes. Remove the cover every few minutes and stir, to ensure that the orzo doesn't stick to the bottom of the pan.",
"Once the orzo is cooked through, add in the coconut milk or heavy cream and spinach and stir until the spinach is wilted.",
"Finally, add in the freshly-grated parmesan cheese and stir one last time.",
"Once it's done, remove it from the heat, serve it immediately, and enjoy!"
],
"yields": "6 servings",
"description": "Tender chicken breasts paired with a creamy sun-dried tomato sauce and hearty orzo is such a good combination, it'll make you want to marry the person who made it for you! Introducing my One-Pan \"Marry Me\" Chicken Orzo, an easy, delicious take on the classic \"Marry Me\" chicken. This dish is the perfect weeknight dinner: it comes together with just one pan and and in a matter of minutes, making it the perfect cozy and comforting weeknight dinner.",
"ratings": 4.84,
"ratings_count": 55,
"image": "https://kalejunkie.com/wp-content/uploads/2024/01/KJOnePanMarryMeChickenOrzo_Shot5_108.jpg"
}
4,735 changes: 4,735 additions & 0 deletions tests/test_data/kalejunkie.com/kalejunkie_1.testhtml

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions tests/test_data/kalejunkie.com/kalejunkie_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"author": "Nicole Modic",
"canonical_url": "https://kalejunkie.com/summer-citrus-salad-with-lemon-shallot-vinaigrette-erewhon-copycat/",
"site_name": "KaleJunkie",
"host": "kalejunkie.com",
"language": "en-US",
"title": "Summer Citrus Salad with Lemon-Shallot Vinaigrette (Erewhon Copycat)",
"ingredients": [
"1 Cup Radicchio (sliced thin - this is approximately 1/2 a head)",
"1 Small Bunch Curly Kale (stems removed and chopped thin - this is approximately 1/2 cup)",
"1 Head Romaine Lettuce (this is approximately 2 cups)",
"2 Avocados (chopped)",
"1 Large Grapefruit (segmented & cut into 1-inch pieces⁣)",
"1 Orange (segmented & cut into 1-inch pieces⁣)",
"1/2 Cup Sunflower Seeds (salted or unsalted - use what you have!)",
"1/3 Cup Olive Oil",
"2 Shallots (finely chopped)",
"2 Cloves Garlic (mashed)",
"1 Tablespoon Dijon Mustard",
"1 Lemon (zested and juiced)",
"1/2 Teaspoon Kosher Salt",
"1/2 Teaspoon Ground Black Pepper"
],
"ingredient_groups": [
{
"ingredients": [
"1 Cup Radicchio (sliced thin - this is approximately 1/2 a head)",
"1 Small Bunch Curly Kale (stems removed and chopped thin - this is approximately 1/2 cup)",
"1 Head Romaine Lettuce (this is approximately 2 cups)",
"2 Avocados (chopped)",
"1 Large Grapefruit (segmented & cut into 1-inch pieces⁣)",
"1 Orange (segmented & cut into 1-inch pieces⁣)",
"1/2 Cup Sunflower Seeds (salted or unsalted - use what you have!)"
],
"purpose": "For the Salad:"
},
{
"ingredients": [
"1/3 Cup Olive Oil",
"2 Shallots (finely chopped)",
"2 Cloves Garlic (mashed)",
"1 Tablespoon Dijon Mustard",
"1 Lemon (zested and juiced)",
"1/2 Teaspoon Kosher Salt",
"1/2 Teaspoon Ground Black Pepper"
],
"purpose": "For the Dressing:"
}
],
"instructions": "To make this salad, start by preparing the dressing. Add the dressing ingredients (the olive oil, shallots, garlic, dijon mustard, lemon, kosher salt, and ground black pepper) to a small bowl and whisk until fully combined.\nTaste and adjust the seasonings as needed, then set the dressing aside and prepare the rest of the salad.\nNext, wash and chop the radicchio, kale, and romaine, and transfer them to a large bowl.\nThen, cut the avocado and add it to the bowl alongside the sunflower seeds.\nPeel, segment, and chop the orange and grapefruit and add them to the salad bowl\nFinally, pour in the dressing and toss to fully combine.\nOnce the salad is tossed, taste and adjust the seasonings as needed. Then, serve and enjoy!",
"instructions_list": [
"To make this salad, start by preparing the dressing. Add the dressing ingredients (the olive oil, shallots, garlic, dijon mustard, lemon, kosher salt, and ground black pepper) to a small bowl and whisk until fully combined.",
"Taste and adjust the seasonings as needed, then set the dressing aside and prepare the rest of the salad.",
"Next, wash and chop the radicchio, kale, and romaine, and transfer them to a large bowl.",
"Then, cut the avocado and add it to the bowl alongside the sunflower seeds.",
"Peel, segment, and chop the orange and grapefruit and add them to the salad bowl",
"Finally, pour in the dressing and toss to fully combine.",
"Once the salad is tossed, taste and adjust the seasonings as needed. Then, serve and enjoy!"
],
"category": "Main Course,Salad",
"yields": "4 servings",
"description": "This bright and vibrant Summer Citrus Salad with Lemon-Shallot Vinaigrette is filled with oranges, grapefruit, and a blend of three crisp lettuces for the ultimate summertime salad. It's a copycat of a recipe from the popular Los Angeles health food store, Erewhon, and is perfect for cooling down on those warm summer days!",
"total_time": 12,
"prep_time": 10,
"cuisine": "American",
"dietary_restrictions": [
"Low Fat Diet",
"Low Lactose Diet",
"Low Salt Diet",
"Vegan Diet",
"Vegetarian Diet"
],
"image": "https://kalejunkie.com/wp-content/uploads/2024/07/KJ-Citrus-Salad-with-Lemon-Shallot-Vinaigrette-9.jpg",
"keywords": [
"Dairy Free",
"gluten-free",
"Grain Free",
"Refined Sugar Free",
"Vegan"
]
}
3,093 changes: 3,093 additions & 0 deletions tests/test_data/kalejunkie.com/kalejunkie_2.testhtml

Large diffs are not rendered by default.

0 comments on commit 9069f9b

Please sign in to comment.