itty-bitty/recipe.py

20 lines
531 B
Python
Raw Normal View History

2022-01-16 21:31:54 +00:00
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(),
2022-02-15 23:28:50 +00:00
'totalTime': "PT" + str(scraper.total_time()) + "M",
2022-01-16 21:31:54 +00:00
'recipeYield': scraper.yields(),
'recipeIngredient': scraper.ingredients(),
2022-01-22 01:24:49 +00:00
'recipeInstructions': scraper.instructions(),
2022-01-16 21:31:54 +00:00
'image': [scraper.image()],
'host': scraper.host(),
'nutrition': scraper.nutrients()
}
json_string = json.dumps(recipe)
print(json_string)