itty-bitty/recipe.py
2022-02-15 17:28:50 -06:00

20 lines
No EOL
531 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': "PT" + str(scraper.total_time()) + "M",
'recipeYield': scraper.yields(),
'recipeIngredient': scraper.ingredients(),
'recipeInstructions': scraper.instructions(),
'image': [scraper.image()],
'host': scraper.host(),
'nutrition': scraper.nutrients()
}
json_string = json.dumps(recipe)
print(json_string)