From 5fc6dedd8eb52bf14a9f65636f225c8927bc9294 Mon Sep 17 00:00:00 2001 From: Joey <7505194+jknndy@users.noreply.github.com> Date: Sat, 14 Dec 2024 14:54:37 -0500 Subject: [PATCH] Groupings and Improved Ingredient Parsing for JamieOliver (#1434) --- recipe_scrapers/jamieoliver.py | 15 + .../jamieoliver.com/jamieoliver.testhtml | 1223 ----------------- .../{jamieoliver.json => jamieoliver_1.json} | 58 +- .../jamieoliver.com/jamieoliver_1.testhtml | 197 +++ .../jamieoliver.com/jamieoliver_2.json | 110 ++ .../jamieoliver.com/jamieoliver_2.testhtml | 155 +++ 6 files changed, 501 insertions(+), 1257 deletions(-) delete mode 100644 tests/test_data/jamieoliver.com/jamieoliver.testhtml rename tests/test_data/jamieoliver.com/{jamieoliver.json => jamieoliver_1.json} (56%) create mode 100644 tests/test_data/jamieoliver.com/jamieoliver_1.testhtml create mode 100644 tests/test_data/jamieoliver.com/jamieoliver_2.json create mode 100644 tests/test_data/jamieoliver.com/jamieoliver_2.testhtml diff --git a/recipe_scrapers/jamieoliver.py b/recipe_scrapers/jamieoliver.py index a2cf8e61e..6dccee576 100644 --- a/recipe_scrapers/jamieoliver.py +++ b/recipe_scrapers/jamieoliver.py @@ -1,4 +1,5 @@ from ._abstract import AbstractScraper +from ._grouping_utils import group_ingredients from ._utils import normalize_string @@ -12,3 +13,17 @@ def instructions(self): instructions_list = method_heading.find_next("ol") instructions = instructions_list.find_all("li") return "\n".join([normalize_string(inst.get_text()) for inst in instructions]) + + def ingredients(self): + ingredients_list = self.soup.select(".ingredients-rich-text p.type-body") + return [ + normalize_string(ingredient.get_text()) for ingredient in ingredients_list + ] + + def ingredient_groups(self): + return group_ingredients( + self.ingredients(), + self.soup, + ".ingredients-rich-text p.type-h5", + ".ingredients-rich-text p.type-body", + ) diff --git a/tests/test_data/jamieoliver.com/jamieoliver.testhtml b/tests/test_data/jamieoliver.com/jamieoliver.testhtml deleted file mode 100644 index 3c1cb875f..000000000 --- a/tests/test_data/jamieoliver.com/jamieoliver.testhtml +++ /dev/null @@ -1,1223 +0,0 @@ - - - - - - - - - - - - - - - Easy chocolate brownie recipe | Best brownie guide | Jamie Oliver - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
-
- - -
-
- - - - - - - - - - -
- - - - -
- - - - - - -
-
- - - - -
- -
-
- - -
-
- -
- -
- - -
-
- - - -
- -
- -
-
- -
-

Bloomin' brilliant brownies

-

Rich dark chocolate, nuts & sour cherries

-
- -
-
- -
-
- -
-
- - - - -
-
-
-
- -
- Bloomin' brilliant brownies
- -
- -
- - - -
- -
- -
-

Bloomin' brilliant brownies

- - - - - -
- - -
-
-
-
- Serves - Serves 20
- -
- Time - Cooks In40 minutes plus chilling time
- -
- DifficultySuper easy
-
-
-
- -
- - - - -
- -
- Nutrition per serving Plus - -
- -
-
    -
  • - -
    - - Calories - - 291 - - 15% -
    - -
  • -
  • - -
    - - Fat - - 18.4g - - 26% -
    - -
  • -
  • - -
    - - Saturates - - 10.1g - - 51% -
    - -
  • -
  • - -
    - - Sugars - - 24.6g - - 27% -
    - -
  • -
  • - -
    - - Salt - - 0.2g - - 3% -
    - -
  • -
  • - -
    - - Protein - - 3.9g - - 8% -
    - -
  • -
  • - -
    - - Carbs - - 28.3g - - 11% -
    - -
  • -
  • - -
    - - Fibre - - 1.6g - - - -
    - -
  • -
- -
- Of an adult's reference intake
- -
- -
- - -
- -
- -
-
- - Cook with Jamie -
- -
- -
-
recipe adapted from
-

Cook with Jamie

- - - By Jamie Oliver - - - - -
-
- -
-
-
- - - - - - -
- -
- -
-
- -
-
- -
- -
- -
-
- -
-
-
-
-
-
- -
-
- Tap For Method
-
-
- - - - - - -
-

Ingredients

-
- - - - - -
-
- -
    -
  • - 200 g quality dark chocolate (70%)
  • -
  • - 250 g unsalted butter
  • -
  • - 75 g dried sour cherries , optional
  • -
  • - 50 g chopped nuts , optional
  • -
  • - 80 g quality cocoa powder
  • -
  • - 65 g plain flour
  • -
  • - 1 teaspoon baking powder
  • -
  • - 360 g caster sugar
  • -
  • - 4 large free-range eggs
  • -
-
-
-
- -
-
- Tap For Method - - -
-
- -
-

The cost per serving below is generated by Whisk.com and is based on costs in individual supermarkets.  For more information about how we calculate costs per serving read our FAQS

- -
- -
- -
- -
- -
-
- - Cook with Jamie -
- -
- -
-
recipe adapted from
-

Cook with Jamie

- - - By Jamie Oliver - - - - -
-
- -
- -
- -
-
- -
- -
- - -
- - -
- -
-
-
-
- -
-
- Tap For Ingredients
-
-
- -
-
-
-

Method

-
-
  1. Preheat the oven to 180°C/350°F/gas 4. Line a 24cm square baking tin with greaseproof paper.
  2. Snap the chocolate into a large bowl, add the butter and place over a pan of simmering water, until melted, stirring regularly. Stir through the cherries and nuts (if using).
  3. Sift the cocoa powder and flour into a separate bowl, add the baking powder and sugar, then mix together.
  4. Add the dry ingredients to the chocolate, cherry and nut mixture and stir together well. Beat the eggs, then mix in until you have a silky consistency.
  5. Pour the brownie mix into the baking tin, and place in the oven for around 25 minutes. You don’t want to overcook them so, unlike cakes, you don’t want a skewer to come out clean – the brownies should be slightly springy on the outside but still gooey in the middle.
  6. Allow to cool in the tray, then carefully transfer to a large chopping board and cut into chunky squares. Delicious served with a dollop of crème fraîche or yoghurt mixed with some orange zest.
- - - - -
- -
-
- -
- -
- -
- - - - -
- -
-
-
-
- - - - - - - - -
- - - - -
- -
- -
- -
-
- - Cook with Jamie -
- -
- -
-
recipe adapted from
-

Cook with Jamie

- - - By Jamie Oliver - - - - -
-
- -
- -
-
- - -
-
- -
- -
- - - -
-
- -
-
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - diff --git a/tests/test_data/jamieoliver.com/jamieoliver.json b/tests/test_data/jamieoliver.com/jamieoliver_1.json similarity index 56% rename from tests/test_data/jamieoliver.com/jamieoliver.json rename to tests/test_data/jamieoliver.com/jamieoliver_1.json index de0d00c42..9730e1fd6 100644 --- a/tests/test_data/jamieoliver.com/jamieoliver.json +++ b/tests/test_data/jamieoliver.com/jamieoliver_1.json @@ -1,19 +1,19 @@ { "author": "Jamie Oliver", - "canonical_url": "https://www.jamieoliver.com/recipes/chocolate-recipes/bloomin-brilliant-brownies/", + "canonical_url": "https://www.jamieoliver.com/recipes/chocolate/bloomin-brilliant-brownies/", "site_name": "Jamie Oliver", "host": "jamieoliver.com", - "language": "en", + "language": "en-GB", "title": "Bloomin' brilliant brownies", "ingredients": [ - "200 g quality dark chocolate (70%)", - "250 g unsalted butter", - "75 g dried sour cherries optional", - "50 g chopped nuts optional", - "80 g quality cocoa powder", - "65 g plain flour", + "200g quality dark chocolate (70%)", + "250g unsalted butter", + "optional: 75g dried sour cherries", + "optional: 50g chopped nuts", + "80g quality cocoa powder", + "65g plain flour", "1 teaspoon baking powder", - "360 g caster sugar", + "360g caster sugar", "4 large free-range eggs" ], "instructions_list": [ @@ -24,36 +24,26 @@ "Pour the brownie mix into the baking tin, and place in the oven for around 25 minutes. You don’t want to overcook them so, unlike cakes, you don’t want a skewer to come out clean – the brownies should be slightly springy on the outside but still gooey in the middle.", "Allow to cool in the tray, then carefully transfer to a large chopping board and cut into chunky squares. Delicious served with a dollop of crème fraîche or yoghurt mixed with some orange zest." ], - "category": "Desserts", + "category": "Baking", "yields": "20 servings", - "description": "This is a great little recipe for easy, fail-safe, gloriously gooey chocolate brownies", + "description": "This easy brownie recipe from Jamie Oliver never disappoints. It's totally foolproof, and packed with dark chocolate, chopped nuts, cocoa powder and sour cherries. Perfect for weekend baking.", "total_time": 40, - "cuisine": "https://schema.org/VegetarianDiet", + "cook_time": 40, "nutrients": { "calories": "291 calories", - "fatContent": "18.4 g fat", - "saturatedFatContent": "10.1 g saturated fat", - "carbohydrateContent": "28.3 g carbohydrate", - "sugarContent": "24.6 g sugar", - "proteinContent": "3.9 g protein", - "sodiumContent": "0.2 g salt", - "fiberContent": "1.6 g fibre" + "fat": "18.4 g", + "portionWeight": "45.9 g", + "protein": "3.9 g", + "salt": "0.2 g", + "saturatedFat": "10.1 g", + "carbs": "28.3 g", + "classification": "140", + "fibre": "1.6 g", + "sugars": "24.6 g" }, - "image": "https://img.jamieoliver.com/jamieoliver/recipe-database/oldImages/large/88_1_1441269331.jpg?tr=w-800,h-800", + "image": "https://asset.jamieoliver.com/images/cq7w2e71/production/f1e42faa99fb1756e2e1463a8b6af3429a4c323a-1447x2171.jpg/brillbrownies.jpg?rect=0,432,1447,1447&w=600&h=600&fm=webp&q=75&fit=crop&auto=format", "keywords": [ - "chocolate", - "brownies", - "brownie", - "vegetarian", - "sweets and desserts", - "baking", - "cooking", - "chocolate brownies", - "party food", - "baking and desserts", - "Christmas", - "Dinner Party", - "non-promotable", - "Popular" + "Party Food", + "Chocolate Main Ingredient" ] } diff --git a/tests/test_data/jamieoliver.com/jamieoliver_1.testhtml b/tests/test_data/jamieoliver.com/jamieoliver_1.testhtml new file mode 100644 index 000000000..dd8b9593e --- /dev/null +++ b/tests/test_data/jamieoliver.com/jamieoliver_1.testhtml @@ -0,0 +1,197 @@ + +Easy chocolate brownie recipe + + + + + + + + + + +
Jamie drizzling honey on top of a fig tart

Share your review and contribute to our community!

Save and access your favourite recipes and products.

+Enter the email address associated with your account, and we’ll email you a link to reset your + password. +

Password Strength

Must contain at least

+*Enter your email to receive news and exclusive offers from Jamie Oliver Limited about Jamie's + businesses, including books, TV shows, restaurants, products, commercial partners and + campaigning activities. By signing up, you agree to our Terms of Use . Learn how we collect, use and share your data in our Privacy Policy . +

Cart item

Just Added

View bag
Easy chocolate brownies stacked on top of each other
Save recipe

Bloomin' brilliant brownies

Rich dark chocolate, nuts & sour cherries

Easy chocolate brownies stacked on top of each other
Save recipe

40 mins plus chilling time
Super easy

serves 20

About the recipe

This is a great little recipe for easy, fail-safe, gloriously gooey chocolate brownies


nutrition per serving

Calories

g

Fat

g

Saturates

g

Sugars

g

Salt

g

Protein

g

Carbs

g

Fibre

of an adult’s reference intake


Recipe From

Cook with Jamie

Cook with Jamie

+By Jamie Oliver

+Ingredients +

200g quality dark chocolate (70%)

250g unsalted butter

optional: 75g dried sour cherries

optional: 50g chopped nuts

80g quality cocoa powder

65g plain flour

1 teaspoon baking powder

360g caster sugar

4 large free-range eggs

Method

  1. Preheat the oven to 180°C/350°F/gas 4. Line a 24cm square baking tin with greaseproof paper.
  2. Snap the chocolate into a large bowl, add the butter and place over a pan of simmering water, until melted, stirring regularly. Stir through the cherries and nuts (if using).
  3. Sift the cocoa powder and flour into a separate bowl, add the baking powder and sugar, then mix together.
  4. Add the dry ingredients to the chocolate, cherry and nut mixture and stir together well. Beat the eggs, then mix in until you have a silky consistency.
  5. Pour the brownie mix into the baking tin, and place in the oven for around 25 minutes. You don’t want to overcook them so, unlike cakes, you don’t want a skewer to come out clean – the brownies should be slightly springy on the outside but still gooey in the middle.
  6. Allow to cool in the tray, then carefully transfer to a large chopping board and cut into chunky squares. Delicious served with a dollop of crème fraîche or yoghurt mixed with some orange zest.

Tags

Perfect Christmas gifts

Recipes you may like

related features

\ No newline at end of file diff --git a/tests/test_data/jamieoliver.com/jamieoliver_2.json b/tests/test_data/jamieoliver.com/jamieoliver_2.json new file mode 100644 index 000000000..e6b5ac29b --- /dev/null +++ b/tests/test_data/jamieoliver.com/jamieoliver_2.json @@ -0,0 +1,110 @@ +{ + "author": "Romy Gill", + "canonical_url": "https://www.jamieoliver.com/recipes/chicken/murg-makhani", + "site_name": "Jamie Oliver", + "host": "jamieoliver.com", + "language": "en-GB", + "title": "Butter chicken", + "ingredients": [ + "750g (1 lb 10 oz) skinless, boneless chicken (thighs and breast), cut into bite-size pieces", + "10g (½ oz) ginger root, peeled and grated (shredded)", + "3 large garlic cloves, peeled and grated (shredded)", + "2 tsp tandoori masala", + "1 tsp ground cumin", + "1 tsp ground coriander", + "1 tsp ground black pepper", + "1 tsp salt", + "2 tbsp yoghurt", + "juice of ½ lemon", + "30ml (1 fl oz/2 tbsp) sunflower oil", + "500g (1 lb 2 oz) tomatoes", + "50g (2 oz) butter", + "20g (3/4 oz) ginger root, peeled and grated (shredded)", + "6 large garlic cloves, peeled and grated (shredded)", + "1 tsp tomato purée (paste)", + "1 tsp tandoori masala", + "1 tsp ground cumin", + "1 tsp ground coriander", + "1 tsp chilli powder", + "1 tsp salt", + "1 tsp sugar", + "30g (1½ oz) ground cashew nuts", + "30ml (1 fl oz/2 tbsp) double (heavy) cream", + "6–8 green cardamom seeds, crushed", + "2 tsp dried fenugreek leaves (kasoori methi)", + "your choice of Indian flatbreads or rice" + ], + "ingredient_groups": [ + { + "ingredients": [ + "750g (1 lb 10 oz) skinless, boneless chicken (thighs and breast), cut into bite-size pieces" + ], + "purpose": null + }, + { + "ingredients": [ + "10g (½ oz) ginger root, peeled and grated (shredded)", + "3 large garlic cloves, peeled and grated (shredded)", + "2 tsp tandoori masala", + "1 tsp ground cumin", + "1 tsp ground coriander", + "1 tsp ground black pepper", + "1 tsp salt", + "2 tbsp yoghurt", + "juice of ½ lemon", + "30ml (1 fl oz/2 tbsp) sunflower oil" + ], + "purpose": "FOR THE MARINADE" + }, + { + "ingredients": [ + "500g (1 lb 2 oz) tomatoes", + "50g (2 oz) butter", + "20g (3/4 oz) ginger root, peeled and grated (shredded)", + "6 large garlic cloves, peeled and grated (shredded)", + "1 tsp tomato purée (paste)", + "1 tsp tandoori masala", + "1 tsp ground cumin", + "1 tsp ground coriander", + "1 tsp chilli powder", + "1 tsp salt", + "1 tsp sugar", + "30g (1½ oz) ground cashew nuts", + "30ml (1 fl oz/2 tbsp) double (heavy) cream", + "6–8 green cardamom seeds, crushed", + "2 tsp dried fenugreek leaves (kasoori methi)" + ], + "purpose": "FOR THE SAUCE" + }, + { + "ingredients": [ + "your choice of Indian flatbreads or rice" + ], + "purpose": "TO SERVE" + } + ], + "instructions_list": [ + "To make the marinade, mix all of the marinade ingredients together in a large bowl. Prick the chicken pieces with a fork to allow the marinade to penetrate the meat. Add the chicken to the bowl and stir well to coat thoroughly. Cover the bowl and set aside in the fridge to marinate for at least a couple of hours.", + "When ready to cook, preheat the oven to 180ºC fan/400ºF/gas 6. Spread the marinated chicken out on a baking tray and cook in the hot oven for 15 minutes.", + "While the chicken is cooking, make the sauce. If the chicken finishes cooking before you have finished making the sauce, switch the oven off after the 15 minutes and leave the meat to rest in the oven.", + "Blanch the tomatoes in a bowl of boiling water for a few minutes, then remove their skins. Cut into quarters and remove the seeds, then roughly chop and place in a food processor. Blitz to a smooth purée.", + "Heat the butter in a saucepan over a medium heat. Once the butter has melted, add the ginger and garlic and cook for 1 minute. Add the puréed fresh tomatoes as well as the tomato purée and cook for 8–10 minutes until the tomatoes are cooked through, stirring regularly to avoid them sticking and burning. Add all the spices, chilli powder, salt and sugar, mix well and cook for a further 2 minutes until emulsified. Lower the heat, then add the ground cashew nuts and cream, and stir well. Add 500–600 ml (20–24 fl oz/ 2½ cups–scant 3 cups) water – the quantity you choose to add depends on how runny you want the sauce to be. Bring the mixture to a boil, and when it starts bubbling, add the chicken, lower the heat and cook for a further 8–10 minutes.", + "Sprinkle over the cardamom seeds and dried fenugreek leaves. Stir and leave to rest for at least 10 minutes before serving with rice or any Indian flatbreads." + ], + "category": "Cookbook Club", + "yields": "5 servings", + "description": "There's so many different ways to cook butter chicken – discover Romy Gill's take on this iconic dish.", + "cuisine": "Indian", + "nutrients": { + "forKids": "false" + }, + "image": "https://asset.jamieoliver.com/images/cq7w2e71/production/b76ba59841d87b3d49ad8d16b5a2380a505e579a-958x1280.jpg/160329475?rect=0,161,958,958&w=600&h=600&fm=webp&q=75&fit=crop&auto=format", + "keywords": [ + "Cookbook Club", + "Curry", + "Chicken", + "Indian-style", + "Dinner Party", + "Dinner" + ] +} diff --git a/tests/test_data/jamieoliver.com/jamieoliver_2.testhtml b/tests/test_data/jamieoliver.com/jamieoliver_2.testhtml new file mode 100644 index 000000000..c70821728 --- /dev/null +++ b/tests/test_data/jamieoliver.com/jamieoliver_2.testhtml @@ -0,0 +1,155 @@ + +Butter Chicken | Jamie Oliver Cookbook Club + + + + + + + + + + +
Jamie drizzling honey on top of a fig tart

Share your review and contribute to our community!

Save and access your favourite recipes and products.

+Enter the email address associated with your account, and we’ll email you a link to reset your + password. +

Password Strength

Must contain at least

+*Enter your email to receive news and exclusive offers from Jamie Oliver Limited about Jamie's + businesses, including books, TV shows, restaurants, products, commercial partners and + campaigning activities. By signing up, you agree to our Terms of Use . Learn how we collect, use and share your data in our Privacy Policy . +

Cart item

Just Added

View bag
Murg makhani
Save recipe

Butter chicken

Murg makhani

Murg makhani
Save recipe
Not Too Tricky

serves 4-5

About the recipe

There are so many different recipes for butter chicken. This is my take, because there is a lot of spark and dispute going on in India about butter chicken. We served so much butter chicken in our restaurant, so I went in search of the very best butter chicken recipe and researched how it all started. I found this gave me a better understanding of this best-loved dish. With its silky smooth, gently spiced tomato, cashew and cream gravy, it’s a comforting, warming dish that feels decadent. It was in 2013 when I started to take a closer look at butter chicken and its history. My mentor, chef Manjit Gill, took me to the first ever Moti Mahal restaurant in Daryagang in Delhi. A restaurant co-founded by Kundan Lal Jaggi, Kundal Lal Gujral and Maggu (also known as Thakur Das) and it was where they created both butter chicken and dal makhani.



Recipe From

Romy Gill's India

Romy Gill's India

+By Romy Gill

+Ingredients +

750g (1 lb 10 oz) skinless, boneless chicken (thighs and breast), cut into bite-size pieces

FOR THE MARINADE

10g (½ oz) ginger root, peeled and grated (shredded)

3 large garlic cloves, peeled and grated (shredded)

2 tsp tandoori masala

1 tsp ground cumin

1 tsp ground coriander

1 tsp ground black pepper

1 tsp salt

2 tbsp yoghurt

juice of ½ lemon

30ml (1 fl oz/2 tbsp) sunflower oil

FOR THE SAUCE

500g (1 lb 2 oz) tomatoes

50g (2 oz) butter

20g (3/4 oz) ginger root, peeled and grated (shredded)

6 large garlic cloves, peeled and grated (shredded)

1 tsp tomato purée (paste)

1 tsp tandoori masala

1 tsp ground cumin

1 tsp ground coriander

1 tsp chilli powder

1 tsp salt

1 tsp sugar

30g (1½ oz) ground cashew nuts

30ml (1 fl oz/2 tbsp) double (heavy) cream

6–8 green cardamom seeds, crushed

2 tsp dried fenugreek leaves (kasoori methi)

TO SERVE

your choice of Indian flatbreads or rice

Method

  1. To make the marinade, mix all of the marinade ingredients together in a large bowl. Prick the chicken pieces with a fork to allow the marinade to penetrate the meat. Add the chicken to the bowl and stir well to coat thoroughly. Cover the bowl and set aside in the fridge to marinate for at least a couple of hours.
  2. When ready to cook, preheat the oven to 180ºC fan/400ºF/gas 6. Spread the marinated chicken out on a baking tray and cook in the hot oven for 15 minutes.
  3. While the chicken is cooking, make the sauce. If the chicken finishes cooking before you have finished making the sauce, switch the oven off after the 15 minutes and leave the meat to rest in the oven.
  4. Blanch the tomatoes in a bowl of boiling water for a few minutes, then remove their skins. Cut into quarters and remove the seeds, then roughly chop and place in a food processor. Blitz to a smooth purée.
  5. Heat the butter in a saucepan over a medium heat. Once the butter has melted, add the ginger and garlic and cook for 1 minute. Add the puréed fresh tomatoes as well as the tomato purée and cook for 8–10 minutes until the tomatoes are cooked through, stirring regularly to avoid them sticking and burning. Add all the spices, chilli powder, salt and sugar, mix well and cook for a further 2 minutes until emulsified. Lower the heat, then add the ground cashew nuts and cream, and stir well. Add 500–600 ml (20–24 fl oz/ 2½ cups–scant 3 cups) water – the quantity you choose to add depends on how runny you want the sauce to be. Bring the mixture to a boil, and when it starts bubbling, add the chicken, lower the heat and cook for a further 8–10 minutes.
  6. Sprinkle over the cardamom seeds and dried fenugreek leaves. Stir and leave to rest for at least 10 minutes before serving with rice or any Indian flatbreads.

Tags

More Romy Gill recipes

More Indian-style recipes

related features

\ No newline at end of file