forked from hhursev/recipe-scrapers
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from RyanNoelk/dev
Dev to master
- Loading branch information
Showing
33 changed files
with
232 additions
and
1,259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
A simple web scraping tool for recipe sites I use in a project of mine that makes sense to live as | ||
a separate package. | ||
|
||
pip install git+git://github.com/RyanNoelk/[email protected].3 | ||
pip install git+git://github.com/RyanNoelk/[email protected].5 | ||
|
||
then: | ||
|
||
|
@@ -34,16 +34,6 @@ If you are programmer PRs with fixes are warmly welcomed and acknowledged with a | |
### Scrapers available for: | ||
|
||
- [http://allrecipes.com/](http://allrecipes.com/) | ||
- [http://bonappetit.com/](http://bonappetit.com/) | ||
- [http://cookstr.com/](http://cookstr.com/) | ||
- [http://epicurious.com/](http://epicurious.com/) | ||
- [http://finedininglovers.com/](https://www.finedininglovers.com/) | ||
- [http://foodrepublic.com/](http://foodrepublic.com) | ||
- [http://jamieoliver.com/](http://www.jamieoliver.com/) | ||
- [http://mybakingaddiction.com/](http://mybakingaddiction.com/) | ||
- [http://simplyrecipes.com/](http://www.simplyrecipes.com) | ||
- [http://steamykitchen.com/](http://steamykitchen.com/) | ||
- [http://tastykitchen.com/](http://tastykitchen.com/) | ||
- [http://thevintagemixer.com/](http://www.thevintagemixer.com/) | ||
- [http://twopeasandtheirpod.com/](http://twopeasandtheirpod.com/) | ||
- [http://whatsgabycooking.com/](http://whatsgabycooking.com/) | ||
- [http://budgetbytes.com/](http://budgetbytes.com/) | ||
- [http://pamperedchef.com/](http://pamperedchef.com/) | ||
- [http://tasteofhome.com/](http://tasteofhome.com/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
|
||
from fractions import Fraction | ||
from ._abstract import AbstractScraper | ||
from ._utils import normalize_string | ||
|
||
|
||
class BudgetBytesv2(AbstractScraper): | ||
|
||
@classmethod | ||
def host(self): | ||
return 'budgetbytes.com-v2' | ||
|
||
def title(self): | ||
return self.soup.find('h1').get_text() | ||
|
||
def total_time(self): | ||
return { | ||
'prep-time': self.soup.find( | ||
'span', | ||
{'class': 'wprm-recipe-prep_time-minutes'} | ||
).get_text(), | ||
'cook-time': self.soup.find( | ||
'span', | ||
{'class': 'wprm-recipe-cook_time-minutes'} | ||
).get_text() | ||
} | ||
|
||
def servings(self): | ||
return self.soup.find('span', {'itemprop': 'recipeYield'}).get_text().split(' ', 1)[0] | ||
|
||
def ingredients(self): | ||
ingredients_html = self.soup.findAll('li', {'class': 'wprm-recipe-ingredient'}) | ||
ingredients = [] | ||
|
||
for ingredient in ingredients_html: | ||
try: | ||
ingredient_dict = { | ||
'quantity': round(float(sum(Fraction(s) for s in ingredient.find( | ||
'span', | ||
{'class': 'wprm-recipe-ingredient-amount'} | ||
).get_text().split())), 3), | ||
'measurement': ingredient.find( | ||
'span', | ||
{'class': 'wprm-recipe-ingredient-unit'} | ||
).get_text(), | ||
'title': ingredient.find( | ||
'span', | ||
{'class': 'wprm-recipe-ingredient-name'} | ||
).get_text() | ||
} | ||
except AttributeError: | ||
ingredient_dict = { | ||
'title': ingredient.find( | ||
'span', | ||
{'class': 'wprm-recipe-ingredient-name'} | ||
).get_text() | ||
} | ||
except: | ||
ingredient_dict = { | ||
'title': ingredient | ||
} | ||
|
||
ingredients.append(ingredient_dict) | ||
|
||
return ingredients | ||
|
||
def instructions(self): | ||
instructions_html = self.soup.findAll('li', {'class': 'wprm-recipe-instruction'}) | ||
|
||
return [ | ||
normalize_string(instruction.get_text()) | ||
for instruction in instructions_html | ||
] | ||
|
||
def description(self): | ||
li = self.soup.find('article', {'class': 'post'}).findAll('p') | ||
return li[0].get_text() | ||
|
||
def image(self): | ||
return self.soup.find('img', {'class': 'alignnone'})["src"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.