hhursev / recipe-scrapers

Python package for scraping recipes data
MIT License
1.61k stars 505 forks source link

Add Joy the Baker #1084

Closed a1831319 closed 2 months ago

a1831319 commented 2 months ago

This PR adds support for Joy the Baker recipes. There was some schema support for this site, although time fields were not supported and had to be scraped manually.

I implemented a custom fix for total_time(), and figured it would work for prep_time() and cook_time() as well, so I have added those too. Thankfully, the site labels each of these fields, which made it much easier to grab the relevant data. Additionally, some of the recipes do not have a 'time' field, so I have a check to prevent unwanted exceptions. Right now I have it returning None in this case, do let me know if that is incorrect behavior (and if I should add tests for this).

Resolves #1083

jayaddison commented 2 months ago

Thanks for the contribution @a1831319!

There are a few errors that appear when the code for the scraper is loaded on older versions of Python, as displayed by the continuous integration results.

In particular, the Type Union Operator (TypeA | TypeZ) to indicate that multiple types are accepted is only available from Py3.10 onwards.

Fortunately, there's a way to enable support for that on previous versions of Python; adding from __future__ import annotations to the top of the module should fix that up.

jayaddison commented 2 months ago

@a1831319 this has been included and released in v14.56.0 (and also the pre-release v15.0.0-rc3) of recipe-scrapers on PyPi.