forked from hhursev/recipe-scrapers
/
justonecookbook.py
53 lines (39 loc) · 1.31 KB
/
justonecookbook.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
49
50
51
52
53
# mypy: allow-untyped-defs
from ._abstract import AbstractScraper
from ._utils import normalize_string
class JustOneCookbook(AbstractScraper):
@classmethod
def host(cls):
return "justonecookbook.com"
def author(self):
return self.schema.author()
def title(self):
return self.schema.title()
def category(self):
return self.schema.category()
def total_time(self):
return self.schema.total_time()
def yields(self):
return self.schema.yields()
def image(self):
return self.schema.image()
def ingredients(self):
lis = self.soup.find_all("li", {"class": "wprm-recipe-ingredient"})
ingredients = []
for ingredient in lis:
spans = ingredient.findAll(
"span", class_=lambda x: x != "wprm-checkbox-container"
)[1:]
ingredient = []
for span in spans:
ingredient.append(normalize_string(span.get_text()))
ingredients.append(" ".join(ingredient))
return ingredients
def instructions(self):
return self.schema.instructions()
def ratings(self):
return self.schema.ratings()
def cuisine(self):
return self.schema.cuisine()
def description(self):
return self.schema.description()