mealie-recipes / mealie

Mealie is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the url and mealie will automatically import the relevant data or add a family recipe with the UI editor
https://docs.mealie.io
GNU Affero General Public License v3.0
6.78k stars 697 forks source link

Recipe's from Epicurious don't upload. #193

Closed tehniemer closed 3 years ago

tehniemer commented 3 years ago

Here's the log output from trying to upload this recipe. https://www.epicurious.com/recipes/food/views/irish-soda-bread-with-raisins-and-caraway-107136

28-Feb-21 14:39:09 INFO: Recipe Scraped From Web: {'name': 'Irish Soda Bread with Raisins and Caraway', 'author': '/contributors/patrice-bedrosian', 'publisher': 'Bon Appétit', 'aggregateRating': {'properties': {'ratingValue': '4', 'bestRating': '4', 'worstRating': '0', 'reviewCount': '160'}, '@type': 'AggregateRating'}, 'mainEntityOfPage': 'True', 'url': 'https://www.epicurious.com/recipes/food/views/irish-soda-bread-with-raisins-and-caraway-107136', 'description': 'Patrice Bedrosian of Brewster, New York, writes: "In the days that followed September 11, 2001, I — like so many Americans — gravitated toward roast chicken, meat loaf, and anything that brought comfort and ease to my home. You see, my stepbrother, Jerry O\'Leary, a 34-year-old chef working at Cantor Fitzgerald\'s corporate dining room in One World Trade Center, was among the many victims on that terrible day.\n\n"I feel quite certain that Jerry\'s love for cooking stemmed from his mother, Julie Lestrange. And as long as I can remember, she has always had something delicious waiting for my family whenever we visit.\n\n"I would like to share a recipe that Julie has given to me. My hope is that you will, in turn, share it with my fellow readers, encouraging them to enjoy this delicious and comforting Irish bread, to smile, and to remember the love between a mother and a son."\n\nOffer this easy-to-make bread with plenty of butter and your favorite jam.', 'recipeYield': 'Makes 8 to 10 servings', 'recipeInstructions': 'Preparation\n\nPreheat oven to 350°F. Generously butter heavy ovenproof 10- to 12-inch-diameter skillet with 2- to 2 1/2-inch-high sides. Whisk first 5 ingredients in large bowl to blend. Add butter; using fingertips, rub in until coarse crumbs form. Stir in raisins and caraway seeds. Whisk buttermilk and egg in medium bowl to blend. Add to dough; using wooden spoon, stir just until well incorporated (dough will be very sticky).\nTransfer dough to prepared skillet; smooth top, mounding slightly in center. Using small sharp knife dipped into flour, cut 1-inch-deep X in top center of dough. Bake until bread is cooked through and tester inserted into center comes out clean, about 1 hour 15 minutes. Cool bread in skillet 10 minutes. Turn out onto rack and cool completely. (Can be made 1 day ahead. Wrap tightly in foil; store at room temperature.)', 'recipeCuisine': 'Irish', 'recipeCategory': ['Bread', 'Milk/Cream', "St. Patrick's Day", 'Raisin', 'Fall', 'Pan-Fry', 'Caraway', 'Bon Appétit', 'New York'], '@context': 'https://schema.org', '@type': 'Recipe', 'recipeIngredient': ['5 cups all purpose flour', '1 cup sugar', '1 tablespoon baking powder', '1 1/2 teaspoons salt', '1 teaspoon baking soda', '1/2 cup (1 stick) unsalted butter, cut into cubes, room temperature', '2 1/2 cups raisins', '3 tablespoons caraway seeds', '2 1/2 cups buttermilk', '1 large egg']}
INFO:     192.168.10.13:0 - "POST /api/recipes/create-url HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 398, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 199, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 111, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 566, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 41, in app
    response = await func(request)
  File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 201, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 150, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "/usr/local/lib/python3.9/site-packages/starlette/concurrency.py", line 34, in run_in_threadpool
    return await loop.run_in_executor(None, func, *args)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "./routes/recipe/recipe_crud_routes.py", line 30, in parse_recipe_url
    recipe = create_from_url(url.url)
  File "./services/scraper/scraper.py", line 27, in create_from_url
    new_recipe = extract_recipe_from_html(r.text, url)
  File "./services/scraper/scraper.py", line 62, in extract_recipe_from_html
    new_recipe = Cleaner.clean(new_recipe, url)
  File "./services/scraper/cleaner.py", line 40, in clean
    recipe_data["image"] = Cleaner.image(recipe_data["image"])
KeyError: 'image'
28-Feb-21 14:39:09 ERROR: Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 398, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 199, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 111, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 566, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 41, in app
    response = await func(request)
  File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 201, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 150, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "/usr/local/lib/python3.9/site-packages/starlette/concurrency.py", line 34, in run_in_threadpool
    return await loop.run_in_executor(None, func, *args)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "./routes/recipe/recipe_crud_routes.py", line 30, in parse_recipe_url
    recipe = create_from_url(url.url)
  File "./services/scraper/scraper.py", line 27, in create_from_url
    new_recipe = extract_recipe_from_html(r.text, url)
  File "./services/scraper/scraper.py", line 62, in extract_recipe_from_html
    new_recipe = Cleaner.clean(new_recipe, url)
  File "./services/scraper/cleaner.py", line 40, in clean
    recipe_data["image"] = Cleaner.image(recipe_data["image"])
KeyError: 'image'
hay-kot commented 3 years ago

There was an error processing recipes with no image after a refactor. I've got it resolved and the fix will be pushed in the next release. Thanks for reporting the bug! 👍

tehniemer commented 3 years ago

I also noticed that manually entered recipes with no images will not upload, is that part of the same bug or a different issue?

hay-kot commented 3 years ago

I also noticed that manually entered recipes with no images will not upload, is that part of the same bug or a different issue?

It would appear to be a side-effect as I'm able to manually create a recipe without an image and upload an image after the fact.

hay-kot commented 3 years ago

Fixed in v0.4.0