Skip to content

Commit

Permalink
Beautifulsoup findall method may take list of items as argument
Browse files Browse the repository at this point in the history
  • Loading branch information
hhursev committed Oct 11, 2015
1 parent f97c7d2 commit 3a34459
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions recipe_scrapers/mybakingaddiction.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ def ingredients(self):
]

def instructions(self):
instructions_html = self.soup.find('span', {'itemprop': 'recipeInstructions'}).findAll('li')

if len(instructions_html) == 0:
instructions_html = self.soup.find(
'span', {'itemprop': 'recipeInstructions'}).findAll('p')
instructions_html = self.soup.find('span', {'itemprop': 'recipeInstructions'}).findAll(['li', 'p'])

return '\n'.join([
normalize_string(instruction.get_text())
Expand Down
2 changes: 1 addition & 1 deletion recipe_scrapers/twopeasandtheirpod.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def ingredients(self):
]

def instructions(self):
instructions_html = self.soup.find('div', {'class': 'instructions'}).findAll('p')
instructions_html = self.soup.find('div', {'class': 'instructions'}).findAll(['p', 'li'])

return '\n'.join([
normalize_string(instruction.get_text())
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
setup(
name='recipe-scraper',
url='https://github.com/hhursev/recipe-scraper/',
version='1.0.0',
version='1.0.1',
description='Python package, scraping recipes from all over the internet',
keywords='python recipes scraper harvest',
long_description=README,
Expand Down

0 comments on commit 3a34459

Please sign in to comment.