Skip to content

feat: add MicroData extractor for recipe parsing and integrate it int… - #37

Merged
dubadub merged 1 commit into
cooklang:mainfrom
evanstern:main
Nov 21, 2025
Merged

feat: add MicroData extractor for recipe parsing and integrate it int…#37
dubadub merged 1 commit into
cooklang:mainfrom
evanstern:main

Conversation

@evanstern

@evanstern evanstern commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

Support for EasyRecipe Format

I have implemented support for the "EasyRecipe" format, which is used by sites like cookingdivine.com.

Changes

Extractors

[NEW] src/extractors/microdata.rs

  • Implemented MicroDataExtractor which uses itemprop selectors within a schema.org/Recipe container.
  • Extracts:
    • Name
    • Description
    • Image
    • Author
    • Prep/Cook/Total times
    • Servings (recipeYield)
    • Course (recipeCategory)
    • Cuisine (recipeCuisine)
    • Diet (suitableForDiet)
    • Tags (keywords)
    • Ingredients (supports ingredients and recipeIngredient)
    • Instructions (supports recipeInstructions and instructions)
  • Design Decision: Enforced itemscope and itemtype="http://schema.org/Recipe" container check to avoid false positives from other schema types on the page.

[MODIFY] src/extractors/mod.rs

  • Registered MicroDataExtractor in the main extractor module.

[MODIFY] src/lib.rs

  • Added MicroDataExtractor to the list of extractors in fetch_recipe_with_timeout, prioritizing it before HtmlClassExtractor.

Verification Results

Automated Tests

  • Renamed tests/test_easyrecipe.rs to tests/test_microdata.rs and updated it to use MicroDataExtractor.
  • Ran cargo test --test test_microdata which passed successfully.
running 1 test
test tests::test_microdata_extraction ... ok

Reference #28

@dubadub

dubadub commented Nov 21, 2025

Copy link
Copy Markdown
Member

Amazing! Looks great!

@dubadub
dubadub merged commit 869ba29 into cooklang:main Nov 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants