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

America's Test Kitchen, failes to parse json due to "tool" list #2523

Open
sudobash1 opened this issue Sep 27, 2024 · 0 comments
Open

America's Test Kitchen, failes to parse json due to "tool" list #2523

sudobash1 opened this issue Sep 27, 2024 · 0 comments

Comments

@sudobash1
Copy link

Failing website: www.americastestkitchen.com

Example of failing recipe: https://www.americastestkitchen.com/recipes/8352-vietnamese-style-caramel-chicken-with-broccoli Other recipes I tried on the site also fail.

Checking if valid metadata are present: Yes, I found the recipe json, and was able to import it manually (with slight edits)

Cookbook version: 0.11.2

Problem description (if applicable):

The recipe import fails. Checking the log I see some warnings and these errors:

Error: Undefined array key "id" at /var/www/html/custom_apps/cookbook/lib/Helper/Filter/JSON/RecipeIdTypeFilter.php#13 
Error: Exception trim(): Argument #1 ($string) must be of type string, array given in file '/var/www/html/custom_apps/cookbook/lib/Helper/Filter/JSON/FixToolsFilter.php' line 59

I viewed the page source, and found the json. I manually copied it to a recipe.json file. However I still got an error when trying to view it. It was the same trim error.

I figured that it must be some array that this recipe json has that most others don't. Looking through it, I found this block:

"tool": [
    {
      "@type": "HowToTool",
      "name": "The Best Chef’s Knives for $75 or Less",
      "image": "https://res.cloudinary.com/hksqkdlah/image/upload/ar_1:1,c_fill,dpr_2.0,f_auto,fl_lossy.progressive.strip_profile,g_faces:auto,q_auto:low,w_150/v1/ATK%20Reviews/2021/Inexpensive%20Chefs%20Knives/SIL_Victorinox-Swiss-Army_Fibrox-Pro-8-Chefs-Knife_9754"
    },
    {
      "@type": "HowToTool",
      "name": "Dutch Ovens",
      "image": "https://res.cloudinary.com/hksqkdlah/image/upload/ar_1:1,c_fill,dpr_2.0,f_auto,fl_lossy.progressive.strip_profile,g_faces:auto,q_auto:low,w_150/32547_can-inexpensive-dutch-ovens-2756-square"
    },
    {
      "@type": "HowToTool",
      "name": "Measuring Spoons",
      "image": "https://res.cloudinary.com/hksqkdlah/image/upload/ar_1:1,c_fill,dpr_2.0,f_auto,fl_lossy.progressive.strip_profile,g_faces:auto,q_auto:low,w_150/22995_sil-measuringspoons-cuisipro-747002"
    }
  ],

It contains nothing of value, and after removing it, I was able to load the recipe just fine.

The recipe instructions could use a little cleaning up too. Step 1 is just ## Recipe Instructions which isn't needed. And the last step is ## Test Kitchen Techniques with nothing following--also unneeded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant