forked from hhursev/recipe-scrapers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaninihappy.py
43 lines (34 loc) · 989 Bytes
/
paninihappy.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
from ._abstract import AbstractScraper
from ._utils import get_minutes, normalize_string
class PaniniHappy(AbstractScraper):
@classmethod
def host(self):
return 'paninihappy.com'
def title(self):
return self.soup.find(
'h1',
{'class': 'entry-title'}
).get_text()
def total_time(self):
return get_minutes(self.soup.find(
'span',
{'class': 'duration'})
)
def ingredients(self):
ingredients = self.soup.findAll(
'li',
{'class': "ingredient"}
)
return [
normalize_string(ingredient.get_text())
for ingredient in ingredients
]
def instructions(self):
instructions = self.soup.findAll(
'li',
{'class': 'instruction'}
)
return '\n'.join([
normalize_string(instruction.get_text())
for instruction in instructions
])