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

GialloZafferano nutritional value #1249

Open
NicolasChagnet opened this issue Sep 5, 2024 · 1 comment
Open

GialloZafferano nutritional value #1249

NicolasChagnet opened this issue Sep 5, 2024 · 1 comment
Labels

Comments

@NicolasChagnet
Copy link

Pre-filing checks

  • [ x ] I have searched for open issues that report the same problem
  • [ x ] I have checked that the bug affects the latest version of the library

The URL of the recipe(s) that are not being scraped correctly

The nutritional value contained in scraper.nutrients() is missing the protein, for example

{'calories': '462 kcal', 'carbohydrateContent': '66.7 g', 'sugarContent': '2.4 g', 'fatContent': '17.8 g', 'saturatedFatContent': '2.59 g', 'fiberContent': '2.2 g', 'cholesterolContent': '0 mg', 'sodiumContent': '497 mg'}

missing 'proteinContent': '8.7 g'.

I checked that this behaviour works on other websites. I tested with https://www.allrecipes.com/recipe/269004/one-pot-spaghetti-with-meat-sauce/ which returns for nutrients

{'calories': '606 kcal', 'carbohydrateContent': '66 g', 'cholesterolContent': '53 mg', 'fiberContent': '2 g', 'proteinContent': '30 g', 'saturatedFatContent': '10 g', 'sodiumContent': '1651 mg', 'sugarContent': '9 g', 'fatContent': '27 g', 'unsaturatedFatContent': '0 g'}

containing the proteins.

@jknndy
Copy link
Collaborator

jknndy commented Sep 24, 2024

Hi @NicolasChagnet, unfortunately this is not a bug but rather how the website structures the information. This sites information is extracted via schema located within the JSON-LD which contains the following nutrition info

"nutrition":{"@type":"NutritionInformation","calories":"462 kcal","carbohydrateContent":"66.7 g","sugarContent":"2.4 g","fatContent":"17.8 g","saturatedFatContent":"2.59 g","fiberContent":"2.2 g","cholesterolContent":"0 mg","sodiumContent":"497 mg"}

which does not contain the protein info. It does appear that information is available elsewhere on the page...

<li>
<span class="gz-list-macros-name">Proteine</span>
<span class="gz-list-macros-unit">g</span>
<span class="gz-list-macros-value">8.7</span>
</li>  

but it is not included in the schema and therefore not gathered by the scraper class.

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

No branches or pull requests

2 participants