Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
12,135 additions
and
1 deletion.
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
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,22 @@ | ||
from ._abstract import AbstractScraper | ||
|
||
|
||
class OwenHan(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "owen-han.com" | ||
|
||
def author(self): | ||
return self.schema.author() | ||
|
||
def title(self): | ||
return self.soup.find("h1", {"class": "entry-title"}).text | ||
|
||
def image(self): | ||
return self.schema.image() | ||
|
||
def ingredients(self): | ||
return [x for x in map(lambda x: x.text, self.soup.select("ul > li"))] | ||
|
||
def instructions(self): | ||
return [x for x in map(lambda x: x.text, self.soup.select("ol > li"))] |
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from recipe_scrapers.owenhan import OwenHan | ||
from tests import ScraperTest | ||
|
||
|
||
class TestOwenHanScraper(ScraperTest): | ||
|
||
scraper_class = OwenHan | ||
|
||
def author(self): | ||
self.assertEqual("Owen Han", self.harvester_class.host()) | ||
|
||
def test_host(self): | ||
self.assertEqual("owen-han.com", self.harvester_class.host()) | ||
|
||
def test_title(self): | ||
self.assertEqual("Chicken Bacon Ranch", self.harvester_class.title()) | ||
|
||
def test_image(self): | ||
self.assertEqual( | ||
"http://static1.squarespace.com/static/627be79397093e2de753b260/627c408602fed77ca384eb11/63120c4090e9bf706973d712/1662127792157/IMG_2037.jpg?format=1500w", | ||
self.harvester_class.image(), | ||
) | ||
|
||
def test_ingredients(self): | ||
self.assertEqual( | ||
[ | ||
"Baguette", | ||
"1 chicken breast", | ||
"3 slices bacon", | ||
"Salt + Pepper", | ||
"Oregano", | ||
"Pepper Jack cheese", | ||
"Avocado", | ||
"Pickled onions", | ||
"1 cup plain non fat greek yogurt", | ||
"1/3 cup buttermilk", | ||
"1 lemon juiced", | ||
"1 tbsp fresh parsley", | ||
"1 tbsp fresh dill", | ||
"2 tsp garlic powder", | ||
"2 tsp onion powder", | ||
], | ||
self.harvester_class.ingredients(), | ||
) | ||
|
||
def test_instructions(self): | ||
self.assertEqual( | ||
[ | ||
"Cut the chicken and bacon into even thin strips.", | ||
"Place bacon in a skillet over medium heat. Cook until it's almost completely cooked, but not too crispy.", | ||
"Remove the bacon and add the chicken to the skillet.", | ||
"Season with oregano and lightly with salt. Cook until no longer pink.", | ||
"Turn off the heat, add the bacon back to the skillet and combine.", | ||
"Add pepper jack on top and cover to melt.", | ||
"For the ranch combine all the ingredients to a bowl and mix well to combine.", | ||
"Assemble: to a toasted baguette add the chicken and bacon then top with sliced avocado pickled onions, and ranch. Add some mixed greens to the other half. ", | ||
"Close the sandwich, cut in half and enjoy!", | ||
], | ||
self.harvester_class.instructions(), | ||
) |