This is a helper package to save data acquired through recipe-scrapers in a format that is importable by RecipeSage (JSON-LD, implemented here).
pip install recipe-scrapers-sage
To directly export a scraped recipe, use the export_recipe
function:
from recipe_scrapers import scrape_me
from recipe_scrapers_sage import export_recipe
scraper = scrape_me("<RECIPE URL>")
sage_json: dict = export_recipe(scraper)
# write `sage_json` to a file that RecipeSage can import
If you wish to modify a scraped recipe, use the RecipeSage
class:
from recipe_scrapers import scrape_me
from recipe_scrapers_sage import RecipeSage
scraper = scrape_me("<RECIPE URL>")
recipe_sage = RecipeSage.from_scraper(scraper)
recipe_sage.creditText = "<CREDIT TEXT>"
sage_json: dict = recipe_sage.to_json_ld()
# write `sage_json` to a file that RecipeSage can import