itty-bitty/recipe.py
2022-01-16 13:31:54 -08:00

20 lines
No EOL
525 B
Python

from recipe_scrapers import scrape_me
import json
import sys
# give the url as a string, it can be url from any site listed below
scraper = scrape_me(sys.argv[1])
recipe = {
'name': scraper.title(),
'totalTime': scraper.total_time(),
'recipeYield': scraper.yields(),
'recipeIngredient': scraper.ingredients(),
'recipeInstructions': [{'text': scraper.instructions()}],
'image': [scraper.image()],
'host': scraper.host(),
'nutrition': scraper.nutrients()
}
json_string = json.dumps(recipe)
print(json_string)