Skip to content

Commit

Permalink
Add in inspiralized support
Browse files Browse the repository at this point in the history
  • Loading branch information
hhursev committed May 3, 2018
1 parent 8c02731 commit 779f81a
Show file tree
Hide file tree
Showing 6 changed files with 2,754 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ If you are programmer PRs with fixes are warmly welcomed and acknowledged with a
- [http://foodnetwork.com/](http://www.foodnetwork.com)
- [http://foodrepublic.com/](http://foodrepublic.com)
- [http://giallozafferano.it/](http://giallozafferano.it)
- [https://inspiralized.com/](https://inspiralized.com/)
- [http://jamieoliver.com/](http://www.jamieoliver.com/)
- [https://healthyeating.nhlbi.nih.gov/](https://healthyeating.nhlbi.nih.gov/)
- [http://mybakingaddiction.com/](http://mybakingaddiction.com/)
Expand Down
2 changes: 2 additions & 0 deletions recipe_scrapers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .foodrepublic import FoodRepublic
from .giallozafferano import GialloZafferano
from .hundredandonecookbooks import HundredAndOneCookbooks
from .inspiralized import Inspiralized
from .jamieoliver import JamieOliver
from .mybakingaddiction import MyBakingAddiction
from .nihhealthyeating import NIHHealthyEating
Expand Down Expand Up @@ -39,6 +40,7 @@
FoodRepublic.host(): FoodRepublic,
GialloZafferano.host(): GialloZafferano,
HundredAndOneCookbooks.host(): HundredAndOneCookbooks,
Inspiralized.host(): Inspiralized,
JamieOliver.host(): JamieOliver,
MyBakingAddiction.host(): MyBakingAddiction,
NIHHealthyEating.host(): NIHHealthyEating,
Expand Down
40 changes: 40 additions & 0 deletions recipe_scrapers/inspiralized.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from ._abstract import AbstractScraper
from ._utils import get_minutes, normalize_string


class Inspiralized(AbstractScraper):

@classmethod
def host(self):
return 'inspiralized.com'

def title(self):
return self.soup.find('h1').get_text()

def total_time(self):
return get_minutes(self.soup.find(
'span',
{'itemprop': 'totalTime'})
)

def ingredients(self):
ingredients = self.soup.findAll(
'li',
{'class': 'ingredient', 'itemprop': 'ingredients'}
)

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
])
Loading

0 comments on commit 779f81a

Please sign in to comment.