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

Add handletheheat.com #680

Merged
merged 1 commit into from Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -160,6 +160,7 @@ Scrapers available for:
- `https://gousto.co.uk/ <https://gousto.co.uk>`_
- `https://greatbritishchefs.com/ <https://greatbritishchefs.com>`_
- `https://halfbakedharvest.com/ <https://www.halfbakedharvest.com/>`_
- `https://handletheheat.com/ <https://handletheheat.com/>`_
- `https://www.hassanchef.com/ <https://www.hassanchef.com/>`_
- `https://headbangerskitchen.com/ <https://www.headbangerskitchen.com/>`_
- `https://www.heb.com/ <https://www.heb.com/recipe/landing>`_
Expand Down
2 changes: 2 additions & 0 deletions recipe_scrapers/__init__.py
Expand Up @@ -84,6 +84,7 @@
from .goustojson import GoustoJson
from .greatbritishchefs import GreatBritishChefs
from .halfbakedharvest import HalfBakedHarvest
from .handletheheat import HandleTheHeat
from .hassanchef import HassanChef
from .headbangerskitchen import HeadbangersKitchen
from .heb import HEB
Expand Down Expand Up @@ -304,6 +305,7 @@
GreatBritishChefs.host(): GreatBritishChefs,
HEB.host(): HEB,
HalfBakedHarvest.host(): HalfBakedHarvest,
HandleTheHeat.host(): HandleTheHeat,
HassanChef.host(): HassanChef,
HeadbangersKitchen.host(): HeadbangersKitchen,
HeinzBrasil.host(): HeinzBrasil,
Expand Down
26 changes: 26 additions & 0 deletions recipe_scrapers/handletheheat.py
@@ -0,0 +1,26 @@
# mypy: disallow_untyped_defs=False
from ._abstract import AbstractScraper


class HandleTheHeat(AbstractScraper):
@classmethod
def host(cls, domain="handletheheat.com"):
return domain

def title(self):
return self.schema.title()

def total_time(self):
return self.schema.total_time()

def yields(self):
return self.schema.yields()

def image(self):
return self.schema.image()

def ingredients(self):
return self.schema.ingredients()

def instructions(self):
return self.schema.instructions()
3,182 changes: 3,182 additions & 0 deletions tests/test_data/handletheheat.testhtml

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions tests/test_handletheheat.py
@@ -0,0 +1,58 @@
from recipe_scrapers.handletheheat import HandleTheHeat
from tests import ScraperTest


class TestHandleTheHeatScraper(ScraperTest):

scraper_class = HandleTheHeat

def test_host(self):
self.assertEqual("handletheheat.com", self.harvester_class.host())

def test_canonical_url(self):
self.assertEqual(
"https://handletheheat.com/chewy-brownies/",
self.harvester_class.canonical_url(),
)

def test_title(self):
self.assertEqual(self.harvester_class.title(), "Best Ever Chewy Brownies")

def test_author(self):
self.assertEqual(self.harvester_class.author(), "Tessa Arias")

def test_yields(self):
self.assertEqual("9 servings", self.harvester_class.yields())

def test_total_time(self):
self.assertEqual(45, self.harvester_class.total_time())

def test_image(self):
self.assertEqual(
"https://handletheheat.com/wp-content/uploads/2017/03/Chewy-Brownies-Square-1.jpg",
self.harvester_class.image(),
)

def test_ingredients(self):
self.assertEqual(
[
"5 tablespoons (71 grams) unsalted butter",
"1 1/4 cups (249 grams) granulated sugar",
"2 large eggs plus 1 egg yolk, (cold)",
"1 teaspoon vanilla extract",
"1/3 cup vegetable oil",
"3/4 cup (75 grams) unsweetened cocoa powder",
"1/2 cup (63 grams) all-purpose flour",
"1/8 teaspoon baking soda",
"1 tablespoon cornstarch",
"1/4 teaspoon salt",
"3/4 cup (128 grams) semisweet chocolate chips",
],
self.harvester_class.ingredients(),
)

def test_instructions(self):
return self.assertEqual(
"Preheat the oven to 325°F. Line a 8 by 8-inch pan with foil or parchment paper and spray with nonstick cooking spray.\nIn a microwave safe bowl, add the butter and sugar. Microwave for about 1 minute, or until the butter is melted. Whisk in the eggs, egg yolk, and vanilla. Stir in the oil and cocoa powder.\nWith a rubber spatula, stir in the flour, baking soda, cornstarch, and salt until combined. Stir in the chocolate chips.\nSpread the brownie batter evenly into the prepared pan. Place in the oven and bake for 30 minutes, or until the brownies are set and a cake tester inserted into the center has moist crumbs attached. Do not overcook. Let cool completely before cutting and serving.\nBrownies can be stored in an airtight container at room temperature for up to 3 days.",
self.harvester_class.instructions(),
)