@@ -9,22 +9,35 @@ def host(cls):
99 return "donnahay.com.au"
1010
1111 def author (self ):
12- return self . schema . author ()
12+ return "Donna Hay"
1313
1414 def title (self ):
15- return self .schema .title ()
16-
17- def category (self ):
18- return self .schema .category ()
19-
20- def total_time (self ):
21- return self .schema .total_time ()
15+ return (
16+ self .soup .find ("h1" , class_ = "text-center recipe-title__mobile" )
17+ .getText ()
18+ .upper ()
19+ )
2220
2321 def yields (self ):
24- return self .schema .yields ()
22+ div = self .soup .find ("div" , class_ = "col-sm-6 method" )
23+ instructions = div .findAll ("li" )
24+ last_instruction = instructions [len (instructions ) - 1 ]
25+ if last_instruction .find ("b" ) is not None :
26+ return last_instruction .find ("b" ).getText ()
27+ else :
28+ array = last_instruction .getText ().split ("." )
29+ for entry in array :
30+ if "Serves" in entry :
31+ if entry [0 ] == " " :
32+ yield_ = entry .replace (" " , "" , 1 )
33+ return yield_
2534
2635 def image (self ):
27- return self .schema .image ()
36+ div = self .soup .find ("div" , class_ = "image-frame recipes" )
37+ if not div :
38+ return
39+ image = div .find ("img" )
40+ return image ["src" ]
2841
2942 def ingredients (self ):
3043 return self .schema .ingredients ()
@@ -37,15 +50,16 @@ def instructions(self):
3750 for instruction in instructions :
3851 text = instruction .get_text (separator = " " , strip = True )
3952 if "Serves" in text :
40- text = text .split ("Serves" , 1 )[0 ].strip () # Remove the sentence starting with Serves
53+ text = text .split ("Serves" , 1 )[
54+ 0
55+ ].strip () # Remove the sentence starting with Serves
4156 instruction .string = text
4257 return instructions
4358
44- def ratings (self ):
45- return self .schema .ratings ()
46-
47- def cuisine (self ):
48- return self .schema .cuisine ()
49-
50- def description (self ):
51- return self .schema .description ()
59+ def keywords (self ):
60+ div = self .soup .find ("div" , class_ = "section text-left" )
61+ tags = div .find_all ("a" )
62+ keywords = []
63+ for tag in tags :
64+ keywords .append (tag .getText ())
65+ return keywords
0 commit comments