forked from hhursev/recipe-scrapers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsteamykitchen.py
33 lines (24 loc) · 1.02 KB
/
steamykitchen.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
from ._abstract import AbstractScraper
from ._utils import get_minutes, normalize_string
class SteamyKitchen(AbstractScraper):
@classmethod
def host(self):
return 'steamykitchen.com'
def title(self):
return self.soup.find('span', {'itemprop': 'name'}).get_text()
def total_time(self):
return get_minutes(self.soup.find('meta', {'itemprop': 'prepTime'})) +\
get_minutes(self.soup.find('meta', {'itemprop': 'cookTime'}))
def ingredients(self):
ingredients_html = self.soup.findAll('span', {'itemprop': "ingredients"})
return [
normalize_string(ingredient.get_text())
for ingredient in ingredients_html
if len(normalize_string(ingredient.get_text())) > 0
]
def instructions(self):
instructions_html = self.soup.findAll('span', {'itemprop': 'recipeInstructions'})
return '\n'.join([
normalize_string(instruction.get_text())
for instruction in instructions_html
])