nextcloud / cookbook

🍲 A library for all your recipes
https://apps.nextcloud.com/apps/cookbook
GNU Affero General Public License v3.0
540 stars 92 forks source link

Cannot parse recipe from swrfernsehen.de/kaffee-oder-tee #1617

Open buderu opened 1 year ago

buderu commented 1 year ago

Failing website: https://www.swrfernsehen.de/kaffee-oder-tee/rezepte/eier-curry-100.html

Checking if valid metadata are present:

[x] Yes, I check the source code of the website and found metadata.

Cookbook version: 0.10.2

Problem description (if applicable):

The page cannot be imported. The error message is:

Exception: OCA\Cookbook\Helper\TextCleanupHelper::cleanUp(): 
Argument #1 ($str) must be of type ?string, array given, called in 
/var/www/html/custom_apps/cookbook/lib/Helper/Filter/JSON/RecipeNameFilter.php on line 26 in file '/var/www/html/custom_apps/cookbook/lib/Helper/TextCleanupHelper.php' line 14

0. /var/www/html/lib/private/AppFramework/App.php - line 172:
OC\AppFramework\Http\Dispatcher->dispatch([ "OCA\\Cook ... "], "import")
1. /var/www/html/lib/private/Route/Router.php - line 298:
OC\AppFramework\App::main("OCA\\Cookbo ... r", "import", [ "OC\\AppFr ... "], [ "cookbook.recipe.import"])
2. /var/www/html/lib/base.php - line 1047:
OC\Route\Router->match("/apps/cookbook/webapp/import")
3. /var/www/html/index.php - line 36:
OC::handleRequest()

Caused by TypeError: OCA\Cookbook\Helper\TextCleanupHelper::cleanUp(): 
Argument #1 ($str) must be of type ?string, array given, called in 
/var/www/html/custom_apps/cookbook/lib/Helper/Filter/JSON/RecipeNameFilter.php on line 26

0. /var/www/html/custom_apps/cookbook/lib/Helper/Filter/JSON/RecipeNameFilter.php - line 26:
OCA\Cookbook\Helper\TextCleanupHelper->cleanUp([ "SWR","SWR ... "], true, true)
1. /var/www/html/custom_apps/cookbook/lib/Helper/Filter/JSONFilter.php - line 63:
OCA\Cookbook\Helper\Filter\JSON\RecipeNameFilter->apply([ "Recipe"," ... ]])
2. /var/www/html/custom_apps/cookbook/lib/Service/RecipeService.php - line 177:
OCA\Cookbook\Helper\Filter\JSONFilter->apply([ "Recipe"," ... ]])
3. /var/www/html/custom_apps/cookbook/lib/Service/RecipeService.php - line 324:
OCA\Cookbook\Service\RecipeService->checkRecipe([ "Recipe"," ... ]])
4. /var/www/html/custom_apps/cookbook/lib/Controller/Implementation/RecipeImplementation.php - line 222:
OCA\Cookbook\Service\RecipeService->downloadRecipe("https://www ... l")
5. /var/www/html/custom_apps/cookbook/lib/Controller/RecipeController.php - line 85:
OCA\Cookbook\Controller\Implementation\RecipeImplementation->import()
6. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 225:
OCA\Cookbook\Controller\RecipeController->import()
7. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 133:
OC\AppFramework\Http\Dispatcher->executeController([ "OCA\\Cook ... "], "import")
8. /var/www/html/lib/private/AppFramework/App.php - line 172:
OC\AppFramework\Http\Dispatcher->dispatch([ "OCA\\Cook ... "], "import")
9. /var/www/html/lib/private/Route/Router.php - line 298:
OC\AppFramework\App::main("OCA\\Cookbo ... r", "import", [ "OC\\AppFr ... "], [ "cookbook.recipe.import"])
10. /var/www/html/lib/base.php - line 1047:
OC\Route\Router->match("/apps/cookbook/webapp/import")
11. /var/www/html/index.php - line 36:
OC::handleRequest()

When importing, the recipe gets disturbed, because the page contains multiple meta data elements with itemprop="name". Microdata strcure in tha html seems correct as other "name" properties are given within an "itemscope" (e.g. Organisation, Person, BreadcrumbList). When I parse the HTML with the page https://foolip.org/microdatajs/live/ the data is shown correctly.

mko-git commented 3 weeks ago

Hi same issue on my side. It there anything what I can do , Testing etc. this web side is very popular in germany and holds a lot of very nice recipe#s.

I'm on the latest available version 011.2