Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Line breaks are sometimes ignored when importing a recipe #2846

Open
6 tasks done
babolivier opened this issue Dec 15, 2023 · 1 comment
Open
6 tasks done
Labels
bug: confirmed bug Something isn't working

Comments

@babolivier
Copy link

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue (title field is above this).
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • This issue can be replicated on the demo site (https://demo.mealie.io/).

What is the issue you are experiencing?

Apologies if I should have selected the template for a scraping issue. From what I can tell the scraping works fine, the issue is with importing the scraped data in Mealie.

I'm running Mealie version v0.5.6 (which is the version provided by PikaPods). I could not verify precisely on the demo site because I don't know how to access the raw scraped data on there, although I have noticed the line breaks are indeed absent from the recipe once imported.

When importing a recipe from HelloFresh, I have realised that although the scraper has correctly detected line breaks, those line breaks are absent from the final recipe after import.

For example, for this recipe: https://www.hellofresh.co.uk/recipes/sun-dried-tomato-risotto-64107f8a0565a60137055b96

The text for the first step as per the scraper's output (accessed via the /recipes/debugger endpoint) is:

"Preheat your oven to 220°C/200°C fan/gas mark 7. Boil a full kettle. \nTo make your stock, add the boiled water for the risotto (see pantry for amount) to a medium saucepan on high heat.\nStir in the veg stock paste. Bring to the boil, then reduce the heat to the lowest setting."

Note line breaks are present.
After importing, line breaks are not visible. When viewing the recipe's JSON, the text for the first step is:

"Preheat your oven to 220°C/200°C fan/gas mark 7. Boil a full kettle. To make your stock, add the boiled water for the risotto (see pantry for amount) to a medium saucepan on high heat. Stir in the veg stock paste. Bring to the boil, then reduce the heat to the lowest setting."

Note that line breaks have been removed.

Steps to Reproduce

  1. Import a recipe such as the one provided as example
  2. Observe the absence of line breaks in the imported recipes
  3. Show the recipe's raw JSON and observe the absence of line breaks there as well.

Please provide relevant logs

10.0.2.100:0 - "POST /api/recipes/test-scrape-url HTTP/1.1" 200
ERROR: 15-Dec-23 10:10:32 Error parsing recipe func_call for 'performTime'
ERROR: 15-Dec-23 10:10:32 Error parsing recipe func_call for 'cookTime'
<class 'str'>
Sun-Dried Tomato Risotto with Roasted Asparagus and Baby Plum Tomatoes
ERROR: 15-Dec-23 10:10:32 Error parsing recipe func_call for 'image'
ERROR: 15-Dec-23 10:10:32 Error parsing recipe func_call for 'description'
<class 'str'>
Our Sun-Dried Tomato Risotto is a delicious veggie option that makes it easy to eat more veg in your diet and try something new!
ERROR: 15-Dec-23 10:10:32 Error parsing recipe func_call for 'nutrition'
<class 'str'>
2 serving(s)
<class 'str'>
15 Vegetable Stock Paste
<class 'str'>
1 Echalion Shallot
<class 'str'>
1 Garlic Clove
<class 'str'>
150 Asparagus
<class 'str'>
50 Sun-Dried Tomato Paste
<class 'str'>
175 Risotto Rice
<class 'str'>
125 Baby Plum Tomatoes
<class 'str'>
40 Grated Hard Italian Style Cheese
<class 'str'>
12 Balsamic Glaze
<class 'str'>
750 Boiled Water for the Risotto
<class 'str'>
20 Butter
INFO: 15-Dec-23 10:10:32 Scraped Instructions: (Type: <class 'str'>)
Preheat your oven to 220°C/200°C fan/gas mark 7. Boil a full kettle. To make your stock, add the boiled water for the risotto (see pantry for amount) to a medium saucepan on high heat. Stir in the veg stock paste. Bring to the boil, then reduce the heat to the lowest setting.
Halve, peel and chop the shallot into small pieces. Peel and grate the garlic (or use a garlic press). Trim the bottom 2cm from the asparagus and discard. Halve the asparagus widthways.
Heat a drizzle of oil in a large pan on medium heat. Once hot, add the shallot and cook until softened, 3-4 mins. Stir in the garlic and sun-dried tomato paste, then cook for 1 min more. Add the risotto rice, stir and cook until the edges of the rice are translucent, 1-2 mins.
To make your risotto, stir a ladle of stock into the rice. When the stock has been absorbed by the rice, stir in another ladle of stock. Keep the pan on medium heat and continue stirring in stock, letting it absorb each time. The cooking time should take 20-25 mins and your risotto is done when your rice is ‘al dente’ - cooked through but with a tiny bit of firmness left in the middle.
When the risotto has about 10 mins cooking time left, pop the asparagus and baby plum tomatoes onto a large baking tray. Drizzle with oil, season with salt and pepper, then toss to coat. Roast on the middle shelf of your oven until tender, 10-12 mins. When the risotto is cooked, remove from the heat and mix in the butter (see pantry for amount) and two thirds of the hard Italian style cheese. Taste and season with salt and pepper if needed.
When the veg is roasted, serve the risotto in bowls with the asparagus and tomatoes on top. Finish with a drizzle of the balsamic glaze and a sprinkle of the remaining cheese over the top. Enjoy!
<class 'str'>
Preheat your oven to 220°C/200°C fan/gas mark 7. Boil a full kettle. To make your stock, add the boiled water for the risotto (see pantry for amount) to a medium saucepan on high heat. Stir in the veg stock paste. Bring to the boil, then reduce the heat to the lowest setting.
<class 'str'>
Preheat your oven to 220°C/200°C fan/gas mark 7. Boil a full kettle. To make your stock, add the boiled water for the risotto (see pantry for amount) to a medium saucepan on high heat. Stir in the veg stock paste. Bring to the boil, then reduce the heat to the lowest setting.
<class 'str'>
Halve, peel and chop the shallot into small pieces. Peel and grate the garlic (or use a garlic press). Trim the bottom 2cm from the asparagus and discard. Halve the asparagus widthways.
<class 'str'>
Halve, peel and chop the shallot into small pieces. Peel and grate the garlic (or use a garlic press). Trim the bottom 2cm from the asparagus and discard. Halve the asparagus widthways.
<class 'str'>
Heat a drizzle of oil in a large pan on medium heat. Once hot, add the shallot and cook until softened, 3-4 mins. Stir in the garlic and sun-dried tomato paste, then cook for 1 min more. Add the risotto rice, stir and cook until the edges of the rice are translucent, 1-2 mins.
<class 'str'>
Heat a drizzle of oil in a large pan on medium heat. Once hot, add the shallot and cook until softened, 3-4 mins. Stir in the garlic and sun-dried tomato paste, then cook for 1 min more. Add the risotto rice, stir and cook until the edges of the rice are translucent, 1-2 mins.
<class 'str'>
To make your risotto, stir a ladle of stock into the rice. When the stock has been absorbed by the rice, stir in another ladle of stock. Keep the pan on medium heat and continue stirring in stock, letting it absorb each time. The cooking time should take 20-25 mins and your risotto is done when your rice is ‘al dente’ - cooked through but with a tiny bit of firmness left in the middle.
<class 'str'>
To make your risotto, stir a ladle of stock into the rice. When the stock has been absorbed by the rice, stir in another ladle of stock. Keep the pan on medium heat and continue stirring in stock, letting it absorb each time. The cooking time should take 20-25 mins and your risotto is done when your rice is ‘al dente’ - cooked through but with a tiny bit of firmness left in the middle.
<class 'str'>
When the risotto has about 10 mins cooking time left, pop the asparagus and baby plum tomatoes onto a large baking tray. Drizzle with oil, season with salt and pepper, then toss to coat. Roast on the middle shelf of your oven until tender, 10-12 mins. When the risotto is cooked, remove from the heat and mix in the butter (see pantry for amount) and two thirds of the hard Italian style cheese. Taste and season with salt and pepper if needed.
<class 'str'>
When the risotto has about 10 mins cooking time left, pop the asparagus and baby plum tomatoes onto a large baking tray. Drizzle with oil, season with salt and pepper, then toss to coat. Roast on the middle shelf of your oven until tender, 10-12 mins. When the risotto is cooked, remove from the heat and mix in the butter (see pantry for amount) and two thirds of the hard Italian style cheese. Taste and season with salt and pepper if needed.
<class 'str'>
When the veg is roasted, serve the risotto in bowls with the asparagus and tomatoes on top. Finish with a drizzle of the balsamic glaze and a sprinkle of the remaining cheese over the top. Enjoy!
<class 'str'>
When the veg is roasted, serve the risotto in bowls with the asparagus and tomatoes on top. Finish with a drizzle of the balsamic glaze and a sprinkle of the remaining cheese over the top. Enjoy!
INFO: 15-Dec-23 10:10:32 Cleaned Instructions: (Type: <class 'list'>)
[{'text': 'Preheat your oven to 220°C/200°C fan/gas mark 7. Boil a full kettle. To make your stock, add the boiled water for the risotto (see pantry for amount) to a medium saucepan on high heat. Stir in the veg stock paste. Bring to the boil, then reduce the heat to the lowest setting.'}, {'text': 'Halve, peel and chop the shallot into small pieces. Peel and grate the garlic (or use a garlic press). Trim the bottom 2cm from the asparagus and discard. Halve the asparagus widthways.'}, {'text': 'Heat a drizzle of oil in a large pan on medium heat. Once hot, add the shallot and cook until softened, 3-4 mins. Stir in the garlic and sun-dried tomato paste, then cook for 1 min more. Add the risotto rice, stir and cook until the edges of the rice are translucent, 1-2 mins.'}, {'text': 'To make your risotto, stir a ladle of stock into the rice. When the stock has been absorbed by the rice, stir in another ladle of stock. Keep the pan on medium heat and continue stirring in stock, letting it absorb each time. The cooking time should take 20-25 mins and your risotto is done when your rice is ‘al dente’ - cooked through but with a tiny bit of firmness left in the middle.'}, {'text': 'When the risotto has about 10 mins cooking time left, pop the asparagus and baby plum tomatoes onto a large baking tray. Drizzle with oil, season with salt and pepper, then toss to coat. Roast on the middle shelf of your oven until tender, 10-12 mins. When the risotto is cooked, remove from the heat and mix in the butter (see pantry for amount) and two thirds of the hard Italian style cheese. Taste and season with salt and pepper if needed.'}, {'text': 'When the veg is roasted, serve the risotto in bowls with the asparagus and tomatoes on top. Finish with a drizzle of the balsamic glaze and a sprinkle of the remaining cheese over the top. Enjoy!'}]
ERROR: 15-Dec-23 10:10:32 Error parsing recipe func_call for 'totalTime'
ERROR: 15-Dec-23 10:10:32 Error parsing recipe func_call for 'prepTime'
INFO: 15-Dec-23 10:10:32 Image https://img.hellofresh.com/f_auto,fl_lossy,h_640,q_auto,w_1200/hellofresh_s3/image/HF_Y23_R19_W20_UK_R2511-20_Main_low-fd582105.jpg
INFO: 15-Dec-23 10:10:32 Image URL: https://img.hellofresh.com/f_auto,fl_lossy,h_640,q_auto,w_1200/hellofresh_s3/image/HF_Y23_R19_W20_UK_R2511-20_Main_low-fd582105.jpg
INFO: 15-Dec-23 10:10:32 File Name Suffix .jpg
/app/data/recipes/sun-dried-tomato-risotto-with-roasted-asparagus-and-baby-plum-tomatoes/images/original.jpg
INFO: 15-Dec-23 10:10:32 original.jpg Minified: 159.37 kB -> 47.25 kB -> 20.32 kB
10.0.2.100:0 - "POST /api/recipes/create-url HTTP/1.1" 201
/app/data/recipes/sun-dried-tomato-risotto-with-roasted-asparagus-and-baby-plum-tomatoes/images/min-original.webp
10.0.2.100:0 - "GET /api/recipes/summary HTTP/1.1" 200
True True
10.0.2.100:0 - "GET /api/recipes/summary HTTP/1.1" 200
10.0.2.100:0 - "GET /api/recipes/sun-dried-tomato-risotto-with-roasted-asparagus-and-baby-plum-tomatoes HTTP/1.1" 200
True True

Mealie Version

v0.5.6

Deployment

Other (please specify below)

Additional Deployment Details

Pod on https://www.pikapods.com

@babolivier babolivier added bug Something isn't working triage labels Dec 15, 2023
@michael-genson
Copy link
Collaborator

I was able to confirm this behavior on the demo as well. FYI you can debug the scraper here: https://demo.mealie.io/recipe/create/debug

Also, just so you know, 0.5.6 is a very outdated version. I realize that it's what you get with your provider, but you may want to bug them to upgrade or look for a new provider. Even if this is fixed, you won't see the fix until you're able to get to 1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: confirmed bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants