Skip to content

Commit

Permalink
Fix bbcgoodfood instructions repeated, closes #59
Browse files Browse the repository at this point in the history
  • Loading branch information
hhursev committed May 23, 2019
1 parent 4241acb commit f625ffb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
27 changes: 9 additions & 18 deletions recipe_scrapers/bbcgoodfood.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def total_time(self):
])

def ingredients(self):
ingredients = self.soup.find(
'section',
{'id': "recipe-ingredients"}
).findAll('li')
ingredients = self.soup.findAll(
'li',
{'itemprop': "ingredients"}
)

return [
normalize_string(
Expand All @@ -41,21 +41,12 @@ def ingredients(self):
]

def instructions(self):
instructions = self.soup.find(
'section',
{'id': 'recipe-method'}
).findAll('li')
instructions = self.soup.findAll(
'li',
{'itemprop': 'recipeInstructions'}
)

instructions_string = '\n'.join([
return '\n'.join([
normalize_string(instruction.get_text())
for instruction in instructions
])

instructions_string += '\n' + normalize_string(
self.soup.find(
'section',
{'id': 'recipe-method'}
).get_text()
)

return normalize_string(instructions_string)
2 changes: 1 addition & 1 deletion recipe_scrapers/tests/test_bbcgoodfood.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ def test_ingredients(self):

def test_instructions(self):
return self.assertEqual(
"Heat oven to 190C/170C fan/gas 5 and line a 12-hole muffin tin with deep cake cases. Put all the cake ingredients into a large bowl and beat together with electric hand beaters until smooth. Spoon the mix into the cases, then bake for 20 mins until risen and a skewer inserted into the middle comes out dry. Cool completely on a rack. Can be made up to 3 days ahead and kept in an airtight container, or frozen for up to 1 month. For the frosting, work the butter, milk and vanilla into the icing sugar until creamy and pale. Colour with food colouring, if using, then create your own gruesome monster faces using sweets and sprinkles. MethodHeat oven to 190C/170C fan/gas 5 and line a 12-hole muffin tin with deep cake cases. Put all the cake ingredients into a large bowl and beat together with electric hand beaters until smooth. Spoon the mix into the cases, then bake for 20 mins until risen and a skewer inserted into the middle comes out dry. Cool completely on a rack. Can be made up to 3 days ahead and kept in an airtight container, or frozen for up to 1 month.For the frosting, work the butter, milk and vanilla into the icing sugar until creamy and pale. Colour with food colouring, if using, then create your own gruesome monster faces using sweets and sprinkles. Recipe from Good Food magazine, October 2010",
"Heat oven to 190C/170C fan/gas 5 and line a 12-hole muffin tin with deep cake cases. Put all the cake ingredients into a large bowl and beat together with electric hand beaters until smooth. Spoon the mix into the cases, then bake for 20 mins until risen and a skewer inserted into the middle comes out dry. Cool completely on a rack. Can be made up to 3 days ahead and kept in an airtight container, or frozen for up to 1 month.\nFor the frosting, work the butter, milk and vanilla into the icing sugar until creamy and pale. Colour with food colouring, if using, then create your own gruesome monster faces using sweets and sprinkles.",
self.harvester_class.instructions()
)

0 comments on commit f625ffb

Please sign in to comment.