mirror of
https://github.com/hay-kot/mealie.git
synced 2025-07-06 13:02:27 -07:00
Normalize recipe instructions, yield, and image url
Including tests and example recipe data.
This commit is contained in:
parent
838a587ca1
commit
96b9f74f84
18 changed files with 1363 additions and 6 deletions
18
dev/scripts/scrape_recipe.py
Normal file
18
dev/scripts/scrape_recipe.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
"""
|
||||
Helper script to download raw recipe data from a URL and dump it to disk.
|
||||
The resulting files can be used as test input data.
|
||||
"""
|
||||
|
||||
import sys, json
|
||||
from scrape_schema_recipe import scrape_url
|
||||
|
||||
for url in sys.argv[1:]:
|
||||
try:
|
||||
data = scrape_url(url)[0]
|
||||
slug = list(filter(None, url.split("/")))[-1]
|
||||
filename = f"{slug}.json"
|
||||
with open(filename, "w") as f:
|
||||
json.dump(data, f, indent=4, default=str)
|
||||
print(f"Saved {filename}")
|
||||
except Exception as e:
|
||||
print(f"Error for {url}: {e}")
|
Loading…
Add table
Add a link
Reference in a new issue