Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added owen-han.com #599

Merged
merged 3 commits into from Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions README.rst
Expand Up @@ -227,6 +227,7 @@ Scrapers available for:
- `https://nutritionbynathalie.com/blog <https://nutritionbynathalie.com/blog>`_
- `https://cooking.nytimes.com/ <https://cooking.nytimes.com>`_
- `https://ohsheglows.com/ <https://ohsheglows.com>`_
- `https://owen-han.com/ <https://owen-han.com>`_
- `https://101cookbooks.com/ <https://101cookbooks.com/>`_
- `https://www.paleorunningmomma.com/ <https://www.paleorunningmomma.com>`_
- `https://www.panelinha.com.br/ <https://www.panelinha.com.br>`_
Expand Down
4 changes: 3 additions & 1 deletion recipe_scrapers/__init__.py
Expand Up @@ -41,8 +41,8 @@
from .cookingcircle import CookingCircle
from .cookinglight import CookingLight
from .cookpad import CookPad
from .coop import Coop
from .cookstr import Cookstr
from .coop import Coop
from .copykat import CopyKat
from .countryliving import CountryLiving
from .cucchiaio import Cucchiaio
Expand Down Expand Up @@ -142,6 +142,7 @@
from .nytimes import NYTimes
from .ohsheglows import OhSheGlows
from .onehundredonecookbooks import OneHundredOneCookBooks
from .owenhan import OwenHan
from .paleorunningmomma import PaleoRunningMomma
from .panelinha import Panelinha
from .paninihappy import PaniniHappy
Expand Down Expand Up @@ -362,6 +363,7 @@
NutritionByNathalie.host(): NutritionByNathalie,
OhSheGlows.host(): OhSheGlows,
OneHundredOneCookBooks.host(): OneHundredOneCookBooks,
OwenHan.host(): OwenHan,
PaleoRunningMomma.host(): PaleoRunningMomma,
Panelinha.host(): Panelinha,
PaniniHappy.host(): PaniniHappy,
Expand Down
22 changes: 22 additions & 0 deletions recipe_scrapers/owenhan.py
@@ -0,0 +1,22 @@
from ._abstract import AbstractScraper


class OwenHan(AbstractScraper):
@classmethod
def host(cls):
return "owen-han.com"

def author(self):
return "Owen Han"
jayaddison marked this conversation as resolved.
Show resolved Hide resolved

def title(self):
return self.soup.find("h1", {"class": "entry-title"}).text

def image(self):
return self.soup.find("link", {"rel": "image_src"})["href"]

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"))]
12,049 changes: 12,049 additions & 0 deletions tests/test_data/owenhan.testhtml

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions tests/test_owenhan.py
@@ -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(),
)