-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathscraper.py
48 lines (41 loc) · 1.04 KB
/
scraper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""Simple scraper script for recipes."""
from recipe_scrapers import scrape_me
from icecream import ic
scraped = scrape_me(
# "https://mere.eirik.re/hovedrett/char-siu-inspirert-kjottdeig/", wild_mode=True,
"http://localhost:5000/hovedrett/kylling-teryaki-bowl/", wild_mode=True,
# "https://www.hellofresh.no/recipes/char-siu-inspirert-kjottdeig-63ea00c81c9cdaabe476a6c2",
)
methods = {
"canonical_url",
"cooking_method",
"dietary_restrictions",
"equipment",
"host",
"image",
"ingredient_groups",
"ingredients",
"instructions",
"instructions_list",
"keywords",
# "links", # just a big object of all links on the page
"nutrients",
"title",
"to_json",
"total_time",
"yields",
"ratings",
}
def print_info(method: str) -> None:
"""Prints the information from the scraper."""
print()
print(method)
print()
try:
info = getattr(scraped, method)()
except Exception as e:
ic(e)
else:
ic(info)
for m in methods:
print_info(m)